VBA to replace VBA ?

kevinsnewmatrix

New Member
Joined
Apr 18, 2008
Messages
19
I have 9 workbooks that need to be updated to the newest ISO week number. each workbook has 2 modules that referance the week number.

I would like to replace them all at 1 shot. not using replace all but using vba. Maybe pull the week number from a cell ??

Code:
Sheets("Today").Select
    Range("A1").Select
    Workbooks.Open Filename:="P:\Ea\AS\W 32\Points1-MON-Today.xls"
    Range("A1:K1").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    Windows("Week 32.xlsm").Activate
    ActiveSheet.Paste
    Range("A1").Select
    Sheets("Tomorrow").Select
    Workbooks.Open Filename:="P:\Ea\AS\W 32\Points2-MON-Tomorrow.xls"

The 32 in this case needs to be replaced with 33.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
yes, you could pull the week number from a cell...
Say E1 for example

Dim WkNum As Long
WkNum = Sheets("Today").Range("E1")
Workbooks.Open Filename:="P:\Ea\AS\W " & WkNum & "\Points1-MON-Today.xls"


Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,911
Members
452,949
Latest member
beartooth91

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