macro confusion

S

scott

I am trying to create a macro that will perform the same function on
different tabs in a workbook, but whenever i try to run the macro for various
tabs, the macro defaults to the original tab that the macro was created in
and I end up getting an error message with options to end, debug, or cancel.
does anyone have suggestions to how i can fix this?
 
S

scott

I believe I deleted the macro because it wasn't working. Here is my
scenario. In a workbook I have a tab for each month of the year, and in each
tab I am using a 5-point moving average for data that is tabulated for each
day of the month. I also have a tab that summarizes each month, and the only
data that I am putting in that tab is the month, and overall average for each
month. Since the overall average in each tab lies in the same cell (h35), I
want a macro that can go to each tab, pull the value in h35, and return that
value to the summary tab for each respective month. Is this possible?
 
D

Dave Peterson

dim wks as worksheet
for each wks in activeworkbook.worksheets
wks.range("A1").value = "hi"
wks.range("b1").clearcontents
next wks

Make sure you qualify each range (or object or property or method) with "wks.".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top