View Single Post
 
Old 03-02-2022, 01:14 AM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Windows 10 Office 2019
Competent Performer
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 200
Cendrinne is on a distinguished road
Red face Help Please, IF with Selected Paragraph Format & Left Indent with First Line Indent

Hello Pros,
I again beg for your help, guidance.

I feel I'm so close to the correct script. I can't figure out what I'm doing wrong.

I wish to Select most cells in the first column, which are align to the left.

IF the Left Indent = 0 AND First Line Indent = 0 Then
.Left Indent = 0.17
.First Line Indent = -0.11 (which both combination has a reality of 0.06 Indentation)

Else
.Left Indent = 0.36
.First Line Indent = 0.11 (which both combination has a reality of 0.25 Indentation)

What is happening to me, the first selected cell, ok corrects it, but since it's still selected, then it does the Else line, so all the selected cells, becomes 0.25.

I have so many tables to fix (and that is one of my big problems).

Here is the full script I've created:

Code:
Sub test2_T1fr_If_Cell_0v00_put0v06()

    Dim aTbl As Table, oCel As Cell     
    Set aTbl = Selection.Tables(1)

      Selection.SelectCell
      With Selection.ParagraphFormat
          .RightIndent = InchesToPoints(0)
          .Alignment = wdAlignParagraphLeft
         '.FirstLineIndent = InchesToPoints(-0.11)
          .OutlineLevel = wdOutlineLevelBodyText
          .CharacterUnitLeftIndent = 0
          .CharacterUnitRightIndent = 0
         '.CharacterUnitFirstLineIndent = 0
      End With
    
    Selection.SelectCell
    With Selection.ParagraphFormat
      If .LeftIndent = InchesToPoints(0) And .FirstLineIndent = InchesToPoints(0) Then
       .LeftIndent = InchesToPoints(0.17)                                                        'Reality = 0.06
       .FirstLineIndent = InchesToPoints(-0.11)
      
      Else
         .LeftIndent = InchesToPoints(0.36)                                                         'Reality = 0.25
         .FirstLineIndent = InchesToPoints(-0.11)
      
      End If
       
    End With
    
  'Next oCel
    
Set oCel = Nothing: Set aTbl = Nothing
    
    On Error GoTo 0

End Sub
Where is my faux pas in my script?

Please, any guidance. I would be so grateful for insights
***********************

(second issue, is a request for an advice = I wish to do a copy and paste each table numbers which a macro formated to the needs I have. However, each tables has at least 3 rows where it's full. So for example, 3 columns for 20 rows, then 1 full row (merge I guess), then another 5-6 rows, then 1 full row again, etc.
So my issue is I'm trying to paste my formated numbers on the two last columns but I can't select the columns I need due to these anoying merge cells.
So I have to select each row that is full, and split them in either 3 columns or more, depending on the tables.

When you have over 200 tables, I feel like crying.

Any advice you could share with me)

Cendrinne
Reply With Quote