![]() |
Macro to Change Sheet
Hi, I do not have a clue how to get one macro to change
38 sheets in a workbook. I wrote a macro that does what I want it to but I have to click on each tab/worksheet and run the macro 38 times. I would like the macro to run when the workbook is opened. I have exported data from Access into Excel and though the values are formatted as numbers in Access, they are formatted as text in Excel. I get a little green triangle in the upper left corner of each Excel cell, I click in each Excel cell and get a little warning box, I click the box and choose "convert to number". What a pain. Is there a way to get the numbers into Excel formatted as numbers, or is there a way to write a Excel macro to do it for me? Thanks. Andrew |
Macro to Change Sheet
This will go thru every worksheet in a the workbook.
Sub Test1() Dim wks As Worksheet For Each wks In Worksheets wks.Range("A1").Value = 1 Next wks End Sub This will go thru the named worksheets in a the workbook. Sub Test2() Dim v As Variant For Each v In Array("abc", "bcd", "cde") Worksheets(v).Range("A2").Value = v Next v End Sub "Andrew" wrote in message ... Hi, I do not have a clue how to get one macro to change 38 sheets in a workbook. I wrote a macro that does what I want it to but I have to click on each tab/worksheet and run the macro 38 times. I would like the macro to run when the workbook is opened. I have exported data from Access into Excel and though the values are formatted as numbers in Access, they are formatted as text in Excel. I get a little green triangle in the upper left corner of each Excel cell, I click in each Excel cell and get a little warning box, I click the box and choose "convert to number". What a pain. Is there a way to get the numbers into Excel formatted as numbers, or is there a way to write a Excel macro to do it for me? Thanks. Andrew |
All times are GMT +1. The time now is 07:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com