Consulting

Results 1 to 1 of 1

Thread: Checking format of a selected Range

  1. #1
    VBAX Visitor
    Joined
    Aug 2018
    Posts
    1
    Location

    Post Checking format of a selected Range

    Hi I need to check the formating (left allignement of each cell) in a specific range in a sheet. the cell range cannot be hard coded as it varies from document to document. so i used the below code. The problem is, this works when this particular sheet is selected by default. My aim is to have a tool, which will open a file from a path, select the range as given below in particular sheet, and if the formating is not proper, write a remark in the tool's remark area which is a different workbook than the opened workbook. can anyone help with this? I have got the code to open files from the folder. I get the rng properly while compiling, but its not giving the remarks.

    'To Scan through the cells in a range and check left alignment
        With Sheets("Document Information").Range("A1:J55")
        Set rng = .Find(What:="Revision History / ?????? ? ????????? ?????????:", _
                                After:=.Cells(.Cells.Count), _
                                LookIn:=xlValues, _
                                LookAt:=xlWhole, _
                                SearchOrder:=xlByRows, _
                                SearchDirection:=xlNext, _
                                MatchCase:=False)
              
        End With
            rng.Offset(2, 0).Resize(2, 10).Select
        With Selection
            For Rw = 1 To 2
                For C = 1 To 10
                    If Selection.Cells(Rw, C).HorizontalAlignment <> xlLeft Then
                    Sheets("Sheet2").Cells(1, 4).Value = "allign NOT OK"
                    End If
                Next C
            Next Rw
        End With
    Last edited by Aussiebear; 11-06-2021 at 02:52 AM. Reason: Posted to wrong sub forum

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •