Rows Count for Multiple Wsheets in Multiple Wbooks

dellzy

Board Regular
Joined
Apr 24, 2013
Messages
146
Hello Excel Expert,

Can anyone pls correct my code below, please. It supposed to read the rows count for each sheet then do something based on rows count value for that sheet but when I run the code below, it only read once only at the first sheet then use that same value towards all sheets in that same workbook.

Code:
For Each Sheet In ActiveWorkbook.Sheets
Application.DisplayAlerts = False

Sheet.Visible = xlSheetVisible
LRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
With Sheet
.Columns(1).Insert
.Cells(1, 1) = "Source"
.Cells(2, 1) = tix
.Range("A2").Copy Destination:=.Range("A2:A" & LRow)
.Cells(1, 13) = "File"
.Cells(2, 13) = FileName
.Range("M2").Copy Destination:=.Range("M2:M" & LRow)
End With
Sheet.Copy After:=ThisWorkbook.Sheets("Macros")
Next Sheet

Appreciate some prompt help.

Thanks a million.
DZ
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top