View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Macro: Code for skip a row

Hi,

It's not very elegant but try this

Sub WorkbookReport()

Application.ScreenUpdating = False 'DMcRitchie 2000-10-24
Application.Calculation = xlCalculationManual
Dim iSheet As Long
x = 0
For iSheet = 1 To ActiveWorkbook.Worksheets.Count
ActiveCell.Offset(iSheet + x - 1, 0) = "'" & Worksheets(iSheet).Name
ActiveCell.Offset(iSheet + x - 1, 1) = Worksheets(iSheet).[b4].Value
ActiveCell.Offset(iSheet + x - 1, 3) = Worksheets(iSheet).[g31].Value
ActiveCell.Offset(iSheet + x - 1, 5) = Worksheets(iSheet).[m31].Value
ActiveCell.Offset(iSheet + x - 1, 8) = Worksheets(iSheet).[s29].Value
ActiveCell.Offset(iSheet + x - 1, 10) = Worksheets(iSheet).[s31].Value
x = x + 1
Next iSheet
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub


Mike

"Albert" wrote:

In the following Macro to generate a report on a workbook. I would like to
have an empty row between the generated data rows.
Can I also assign a pointer to the cells e.g. " ActiveCell.Offset(iSheet -
1, 1) = Worksheets(iSheet).[b4].Pointer " instead of the value.


Sub WorkbookReport()

Application.ScreenUpdating = False 'DMcRitchie 2000-10-24
Application.Calculation = xlCalculationManual
Dim iSheet As Long
For iSheet = 1 To ActiveWorkbook.Worksheets.Count
ActiveCell.Offset(iSheet - 1, 0) = "'" & Worksheets(iSheet).Name
ActiveCell.Offset(iSheet - 1, 1) = Worksheets(iSheet).[b4].Value
ActiveCell.Offset(iSheet - 1, 3) = Worksheets(iSheet).[g31].Value
ActiveCell.Offset(iSheet - 1, 5) = Worksheets(iSheet).[m31].Value
ActiveCell.Offset(iSheet - 1, 8) = Worksheets(iSheet).[s29].Value
ActiveCell.Offset(iSheet - 1, 10) = Worksheets(iSheet).[s31].Value


Next iSheet
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

Thank you very much.

Albert