How to traverse a range (created by inserting data from certain sheets onto a Master sheet) and modify the data in a column of that range.

SPS41

New Member
Joined
Feb 21, 2023
Messages
28
Office Version
  1. 365
Platform
  1. Windows
The code below pulls data from multiple sheets and pastes it onto a single sheet called the Master sheet.

VBA Code:
On Error GoTo Erfix
Application.ScreenUpdating = False
Sheets("Master").Range("A13", "N10000").ClearContents
For Each wksht In Worksheets

If IsInArray(wksht.name, DefaultSheetNames) = False Then

LR = wksht.Cells(Rows.Count, 1).End(xlUp).Row
Set rng1 = wksht.Range("A11:J" & LR)
Set rng2 = wksht.Range("E9:G9") 
'For i = 11 To LR
'Debug.Print LR
FirstBlankrow = Sheets("Master").Cells(Sheets("Master").Rows.Count, 1).End(xlUp).Row + 2 ' 
Sheets("Master").Cells(FirstBlankrow, 1).Resize(rng2.Rows.Count, rng2.Columns.Count).Cells.value = rng2.Cells.value
FirstBlankrow = Sheets("Master").Cells(Sheets("Master").Rows.Count, 1).End(xlUp).Row + 1 ' 
Sheets("Master").Cells(FirstBlankrow, 1).Resize(rng1.Rows.Count, rng1.Columns.Count).Cells.value = rng1.Cells.value
        
'Next i
End If

Snippet of sheet 1 copied to the master sheet. (Note that the copied sheet starts at the line Multiplier.)
Mastercheck1.png



Snippet of sheet 2 on the Master.
Mastercheck2.png




The images above are snippets of the output based on the code above. I want to navigate to the 4th column from the left and multiply it with the multiplier (wksht.range("F9")). Is there anyway to do that?

One thing to understand is that a range like this is created for every sheet one below another with an empty space between each ( Firstblank row in code), I need to multiply the multiplier only for that particular range (wksht.range("F9")), as the multiplier changes for every sheet. That's why I cant just select the whole column and multiply it with the multiplier.


I am trying this as shown below:

QtyMultiplier = wksht.Range("F9").value ' is located on every sheet, it is always a number
I Don't know how to traverse this new range.

Any help I would appreciate it.

PS: I know that Activesheet may make Excel crash but for now Im using it, I will change that statement in the end. Thanks!

Apologies for berating you with questions. But this the last one!
Thanks a lot!!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,223,896
Messages
6,175,264
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top