jswilson64
New Member
- Joined
- Apr 19, 2011
- Messages
- 2
Howdy! First post, but I have lurked and searched these boards for a while.
I'm using Excel 2003. Trying to write a macro that will go through every tab in a workbook, copy the top row, and then paste-special-transpose that row as a column in a new tab. I have macros that do the tasks I need if I run it manually on every tab. When I add it to a macro that calls my macro for every tab, I get errors that I think are due to it trying to recursively copy or paste. Here is the code I'm using to run on every tab:
Dim wS As Worksheet
For Each wS In Worksheets
wS.Select
Call copy_headers
Next wS
When I run this (calling another macro) I get error 1004, Selection is not valid. I think it's because my copy and paste areas overlap. It's trying to run the macro on the new tab I create earlier and doesn't like it.
My question is, is there a way to do this in one workbook, or will I need to paste my values into a new workbook? Is there a way to run the macro on every tab except one called "Headers" ?
Thanks!
I'm using Excel 2003. Trying to write a macro that will go through every tab in a workbook, copy the top row, and then paste-special-transpose that row as a column in a new tab. I have macros that do the tasks I need if I run it manually on every tab. When I add it to a macro that calls my macro for every tab, I get errors that I think are due to it trying to recursively copy or paste. Here is the code I'm using to run on every tab:
Dim wS As Worksheet
For Each wS In Worksheets
wS.Select
Call copy_headers
Next wS
When I run this (calling another macro) I get error 1004, Selection is not valid. I think it's because my copy and paste areas overlap. It's trying to run the macro on the new tab I create earlier and doesn't like it.
My question is, is there a way to do this in one workbook, or will I need to paste my values into a new workbook? Is there a way to run the macro on every tab except one called "Headers" ?
Thanks!