ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   macro confusion (https://www.excelbanter.com/excel-worksheet-functions/199704-macro-confusion.html)

scott

macro confusion
 
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?

Mike H

macro confusion
 
Hi,

I suspect we may have more idea if we saw the macro.

Mike

"scott" wrote:

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?


Don Guillett

macro confusion
 
Perhaps you can share your code for comments

activesheet.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"scott" wrote in message
...
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?



scott

macro confusion
 
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?
"Mike H" wrote:

Hi,

I suspect we may have more idea if we saw the macro.

Mike

"scott" wrote:

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?


Dave Peterson

macro confusion
 
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.".

scott wrote:

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?


--

Dave Peterson


All times are GMT +1. The time now is 12:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com