Linking using Macors
Hello,
I am trying to create an error report based on multiple worksheets in a workbook. I want to gather 7 or 8 cells from a worksheet and create a new row in the error report with the information. I have determine that using this function (='worksheet-name'!$C$7) i can do it manually. the only macro that i have been able to come up with hard codes the values in and i dont know how to have it loop through all worksheets in my workbook. Any help would be much appreciated Mike |
Linking using Macors
This may get you started
Sub WorksheetLoop() Dim wsName As String Dim WS_Count As Integer Dim i As Integer WS_Count = _ ActiveWorkbook.Worksheets.Count ' Begin the loop. For i = 1 To WS_Count wsName = ActiveWorkbook.Worksheets(i).Name MsgBox "SheetName is:" & wsName & vbCrLf & _ "Value is" & Worksheets(wsName).Range("A1").Value Next i End Sub " wrote: Hello, I am trying to create an error report based on multiple worksheets in a workbook. I want to gather 7 or 8 cells from a worksheet and create a new row in the error report with the information. I have determine that using this function (='worksheet-name'!$C$7) i can do it manually. the only macro that i have been able to come up with hard codes the values in and i dont know how to have it loop through all worksheets in my workbook. Any help would be much appreciated Mike |
Linking using Macors
On Apr 7, 9:17*am, Mike wrote:
This may get you started *Sub WorksheetLoop() * *Dim wsName As String * *Dim WS_Count As Integer * *Dim i As Integer * *WS_Count = _ * *ActiveWorkbook.Worksheets.Count * *' Begin the loop. * *For i = 1 To WS_Count * * * wsName = ActiveWorkbook.Worksheets(i).Name * * * MsgBox "SheetName is:" & wsName & vbCrLf & _ * * * "Value is" & Worksheets(wsName).Range("A1").Value * *Next i End Sub " wrote: Hello, I am trying to create an error report based on multiple worksheets in a workbook. *I want to gather 7 or 8 cells from a worksheet and create a new row in the error report with the information. I have determine that using this function (='worksheet-name'!$C$7) i can do it manually. *the only macro that i have been able to come up with hard codes the values in and i dont know how to have it loop through all worksheets in my workbook. Any help would be much appreciated Mike- Hide quoted text - - Show quoted text - This helped. thank you very much |
Linking using Macors
See also this page
http://www.rondebruin.nl/summary.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm wrote in message ... On Apr 7, 9:17 am, Mike wrote: This may get you started Sub WorksheetLoop() Dim wsName As String Dim WS_Count As Integer Dim i As Integer WS_Count = _ ActiveWorkbook.Worksheets.Count ' Begin the loop. For i = 1 To WS_Count wsName = ActiveWorkbook.Worksheets(i).Name MsgBox "SheetName is:" & wsName & vbCrLf & _ "Value is" & Worksheets(wsName).Range("A1").Value Next i End Sub " wrote: Hello, I am trying to create an error report based on multiple worksheets in a workbook. I want to gather 7 or 8 cells from a worksheet and create a new row in the error report with the information. I have determine that using this function (='worksheet-name'!$C$7) i can do it manually. the only macro that i have been able to come up with hard codes the values in and i dont know how to have it loop through all worksheets in my workbook. Any help would be much appreciated Mike- Hide quoted text - - Show quoted text - This helped. thank you very much |
All times are GMT +1. The time now is 07:50 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com