Hi Experts,
I have got the macro coding that consolidates the sheet which is named as time sheet .I use the following coding below and it works well.
Sub timesheet ()
Dim ws As Worksheet, wsOut As Worksheet, sName As String
sName = "Time Sheet"
Set wsOut = Worksheets.Add(after:=Sheets(Sheets.Count))
For Each ws In Worksheets
If UCase(ws.Name) Like UCase(sName) & "*" Then
zz = ws.Range("N" & Rows.Count).End(xlUp).Row
zz = Application.Max(zz, 4)
ws.Range("A4:A2000", ws.Range("N" & zz)).Copy wsOut.Range("A" & Rows.Count).End(xlUp)(2)
End If
Next ws
End Sub
.but now the entire format of time sheet has been changed and below code need to be Added to macro In order work perfectly
Range("A4").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Which selects the range as per above code and copies and consolidates the sheet.I am really confused where to make the necessary changes tried several times but unable to get appropriate result. I want the macro to follow same earlier procedures but only the selection ranges need to be changed
Thanks for the help
Harsha
I have got the macro coding that consolidates the sheet which is named as time sheet .I use the following coding below and it works well.
Sub timesheet ()
Dim ws As Worksheet, wsOut As Worksheet, sName As String
sName = "Time Sheet"
Set wsOut = Worksheets.Add(after:=Sheets(Sheets.Count))
For Each ws In Worksheets
If UCase(ws.Name) Like UCase(sName) & "*" Then
zz = ws.Range("N" & Rows.Count).End(xlUp).Row
zz = Application.Max(zz, 4)
ws.Range("A4:A2000", ws.Range("N" & zz)).Copy wsOut.Range("A" & Rows.Count).End(xlUp)(2)
End If
Next ws
End Sub
.but now the entire format of time sheet has been changed and below code need to be Added to macro In order work perfectly
Range("A4").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Which selects the range as per above code and copies and consolidates the sheet.I am really confused where to make the necessary changes tried several times but unable to get appropriate result. I want the macro to follow same earlier procedures but only the selection ranges need to be changed
Thanks for the help
Harsha