-1

`tab1.Rows(20).Cells.Merge tab1.Rows(20).Cells(1).Range.Text = "2. Brief of Case. " + objVar(6) tab1.Rows(20).Cells(1).Range.ParagraphFormat.Alignment = wdAlignParagraphJustify

tab1.Rows(22).Cells.Merge tab1.Rows(22).Cells(1).Range.Text = "2. Present Status of the Case. " + objVar(8) tab1.Rows(22).Cells(1).Range.ParagraphFormat.Alignment = wdAlignParagraphJustify`

I want the text in the row 20 cell 1 "Brief of Case" only to be bold and underlined ...rest of the text to be normal and similarly the text in row 22 cell 1 "Present Status of the Case" to be undelrlined and bold

`tab1.Rows(20).Cells.Merge tab1.Rows(20).Cells(1).Range.Text = "2. Brief of Case. " + objVar(6) tab1.Rows(20).Cells(1).Range.ParagraphFormat.Alignment = wdAlignParagraphJustify

tab1.Rows(22).Cells.Merge tab1.Rows(22).Cells(1).Range.Text = "2. Present Status of the Case. " + objVar(8) tab1.Rows(22).Cells(1).Range.ParagraphFormat.Alignment = wdAlignParagraphJustify`

macropod
  • 12,757
  • 2
  • 9
  • 21
  • And what's your question about all this? – Nico Haase Jan 24 '23 at 13:41
  • I want the text in the row 20 cell 1 "Brief of Case" only to be bold and underlined ...rest of the text to be normal and similarly the text in row 22 cell 1 "Present Status of the Case" to be undelrlined and bold. How do i code for it in excel VBA – veer salaria Jan 24 '23 at 14:29
  • Please add all clarification to your question by editing it. Adding a tag for the programming language could also help – Nico Haase Jan 24 '23 at 15:06
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jan 24 '23 at 16:46

1 Answers1

0

For example:

Dim Rng As Range
With tab1
  With .Rows(20)
    .Cells.Merge
    Set Rng = .Cells(1).Range
    With Rng
      .ParagraphFormat.Alignment = wdAlignParagraphJustify
      .Text = objVar(6)
      .Collapse wdCollapseStart
      .Text = "2. Brief of Case. "
      .Font.Bold = True
      .Font.Underlined = True
    End With
  End With
  With .Rows(22)
    .Cells.Merge
    Set Rng = .Cells(1).Range
    With Rng
      .ParagraphFormat.Alignment = wdAlignParagraphJustify
      .Text = objVar(8)
      .Collapse wdCollapseStart
      .Text = "2. Present Status of the Case. "
      .Font.Bold = True
      .Font.Underlined = True
    End With
  End With
End With
macropod
  • 12,757
  • 2
  • 9
  • 21
  • the output required is in following format 2. Brief of Case. .................. ( only the Text "Brief of Case" to be bold and underlined and balance text being input from array varobj(6) to be normal and justified – veer salaria Jan 26 '23 at 03:55
  • Dim strValue1 As String Dim strValue2 As String strValue1 = "Brief of Case: " + (Sheets("Petitions").Cells(nPET, 9).FormulaR1C1) + vbNewLine + vbNewLine strValue2 = "Present Status of the Case: " + (Sheets("Petitions").Cells(nPET, 34).FormulaR1C1) Sheets("Summary_Petitions").Cells(nOpenRecords - 1, 5).Value = strValue1 + strValue2 similarly in the above code how can i make the Text "Brief of Case" and "Present status of the case" as underlined and bold ? – veer salaria Jan 26 '23 at 07:36