Repeating a Macro across multiple worksheets....

chefdt

Board Regular
Joined
Jul 1, 2008
Messages
163
I have work sheet (MAS) with (SALESID) in the first column, and (EMAIL) addresses in the 5th column.

The workbook has many other sheets, that get data from (MAS).


I need a macro that will look at each worksheet, and populate (J2) with an email address from column 5 on (MAS). If (J2) is blank, I need it to move on, and continue with all worksheets.

Any help would be appreciated.

DALE
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
you can select all the relevant workhsheets and type the formula vlookup in one sheet in relevant cells and the formula will be copied in all the relevant sheets

how to select all the relevant sheets. If they are contiguous use shift key oherwise control key and select each of the tabs.
 
Upvote 0
HI
try the following codes
Code:
Sub fill()
dim a as integer
for a = 2 to sheets.count
if worksheets(a).cells(2,10) = "" then
worksheets(a).cells(2,10) = cells(5,5)
endif
next a
end sub
run the macro. it will fill all blank J2 with E5
Now tell me which email ID you wanted there.
Ravi
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,533
Members
448,969
Latest member
mirek8991

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