is it possible in VBA

LearnMeExcel

Well-known Member
Joined
Aug 11, 2009
Messages
746
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
hi

is it poosible in VBA, to make A lot of Copy Form My File With Certian Name, for example

my wb have around 15 ws
and this wb for 22 Products, in master sheet when i select Product all analysis update direct for this product, what i want to do
  1. change all sheets to Value (copy - paste special value)
  2. important point- to save the file with this product , then REOPEN master file, then do same steps for second Product, until Produc 22
any help will be appreciated

thank you in advanced
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
If you record your actions with the macro records on one sheet,

Then you can do a loop in the workbook
for each sheet in sheets
your recording
next
This will do the same action in each sheet
 
Upvote 0
If you record your actions with the macro records on one sheet,

Then you can do a loop in the workbook
for each sheet in sheets
your recording
next
This will do the same action in each sheet
this is not the issue
when you make a loop through Product name, master file will close and saved with prodcut name
HOW I CAN MAKE Excel reopen MAser file autmaticlly and then do same steps for Product 2 ......etc....


i hope it is clear
 
Upvote 0
You could add the workbooks.open function to the code (If you're not sure of the exact text, record opening the master file. Stop recording once open, then review the code.
Otherwise, look to where the master file is being closed and remove that section.

You could also use a code to see if the file is already open, and if not, open it.
Code:
dim alreadyopen as Boolean
dim wb as workbook

For Each wb In Workbooks
    If wb.Name = "Master.xlsx" Then
        alreadyopen = True
        Set Master= wb
        Exit For
    End If
Next wb
If alreadyopen = False Then
    Workbooks.Open Filename:="C:\Master.xlsx", ReadOnly:=True
    Set Master= ActiveWorkbook
    Else
End If
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

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