View Single Post
 
Old 12-17-2023, 07:31 PM
Logit Logit is offline Windows 10 Office 2007
Expert
 
Join Date: Jan 2017
Posts: 587
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default Why Are Both Of These Macros Not Filling Col B On All Sheets ?

Code:
Sub cpyDte()

         Dim WS_Count As Integer
         Dim I As Integer

         ' Set WS_Count equal to the number of worksheets in the active
         ' workbook.
         WS_Count = ActiveWorkbook.Worksheets.Count

          'Begin the loop.
         For I = 1 To WS_Count
            'With ActiveSheet
            Dim c As Range
                For Each c In Range("A2:A350")
                    If c.Value = "private" Then
                        c.Offset(, 1) = "600"
                        c.Offset(, 2) = "0"
                    End If
                Next c
            'End With
         Next I

      End Sub

'ActiveSheet.


Sub SortIt2() 'VBA macro to Loop through sheets and sorts Cols A:E in Ascending order.
Dim ws As Worksheet

For Each ws In Sheets 'Start of the VBA looping procedure.
Dim c As Range
                For Each c In Range("A2:A350")
                    If c.Value = "private" Then
                        c.Offset(, 1) = "600"
                        c.Offset(, 2) = "0"
                    End If
                Next c
Next ws
End Sub
Attached Files
File Type: xlsm Replace3.xlsm (22.0 KB, 4 views)
Reply With Quote