Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-17-2023, 07:31 PM
Logit Logit is offline Why Are Both Of These Macros Not Filling Col B On All Sheets ? Windows 10 Why Are Both Of These Macros Not Filling Col B On All Sheets ? Office 2007
Expert
Why Are Both Of These Macros Not Filling Col B On All Sheets ?
 
Join Date: Jan 2017
Posts: 533
Logit 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, 2 views)
Reply With Quote
  #2  
Old 12-19-2023, 02:08 AM
Johan Verkerk Johan Verkerk is offline Why Are Both Of These Macros Not Filling Col B On All Sheets ? Windows 10 Why Are Both Of These Macros Not Filling Col B On All Sheets ? Office 2013
Novice
 
Join Date: Feb 2021
Posts: 1
Johan Verkerk is on a distinguished road
Default Maybe

Sub cpyDte()
Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
Dim c As Range
For Each c In WS.Range("A2:A350")
If c.Value = "private" Then
c.Offset(, 1) = "600"
c.Offset(, 2) = "0"
End If
Next c
Next WS
End Sub

Sub SortIt2()
Dim WS As Worksheet
For Each WS In Sheets
Dim c As Range
For Each c In WS.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 (25.6 KB, 1 views)
Reply With Quote
  #3  
Old 12-19-2023, 08:09 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline Why Are Both Of These Macros Not Filling Col B On All Sheets ? Windows 10 Why Are Both Of These Macros Not Filling Col B On All Sheets ? Office 2021
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,779
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

@Johan. please wrap your code with code tags (#). Thx
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #4  
Old 12-19-2023, 03:26 PM
Logit Logit is offline Why Are Both Of These Macros Not Filling Col B On All Sheets ? Windows 10 Why Are Both Of These Macros Not Filling Col B On All Sheets ? Office 2007
Expert
Why Are Both Of These Macros Not Filling Col B On All Sheets ?
 
Join Date: Jan 2017
Posts: 533
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

Johan Verkerk thank you so much for pinpointing my oversight.

Merry Christmas
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word Refuses to Allow Macros, even when All Macros Enabled devlon Word VBA 3 10-04-2022 02:15 PM
Why Are Both Of These Macros Not Filling Col B On All Sheets ? Force a user to enable macros in Powerpoint? Hide sheets until the "enable" button is clicked copleyr PowerPoint 1 10-07-2016 01:15 AM
Why Are Both Of These Macros Not Filling Col B On All Sheets ? How to automatically enable the macros upon opening a file with macros? laurieli Office 7 01-17-2016 08:56 AM
How to manage some sheets and sub-sheets? tesoke Excel 6 11-15-2015 04:54 AM
Linking sheets to fetch transactions from sheets to another waqer Excel 4 09-01-2011 12:35 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:15 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft