Linking using Macors

  • Thread starter Thread starter moflaher
  • Start date Start date
M

moflaher

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
 
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
 
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









- Show quoted text -

This helped. thank you very much
 
See also this page
http://www.rondebruin.nl/summary.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


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









- Show quoted text -

This helped. thank you very much
 
Back
Top