Hi Experts,
I have created the macro in order to consolidate sheets only having sheet name june,11 It works fine But I want the macro to select range from A4:A2000 even after giving the ranges it selects the data from A2 I have used both select and activate command but its not working its simple but I am not able to figure it out can anyone help me with this.
Sub x()
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
Dim ws As Worksheet, wsOut As Worksheet, sName As String
<o> </o>
sName = "june'11"
<o> </o>
Set wsOut = Worksheets.Add(after:=Sheets(Sheets.Count))
<o> </o>
For Each ws In Worksheets
If UCase(ws.Name) Like UCase(sName) & "*" Then
ws.Range("A4:A2000", ws.Range("M" & Rows.Count).End(xlUp)).Copy _
wsOut.Range("A" & Rows.Count).End(xlUp)(2)
End If
Next ws
<o> </o>
<o> </o>
<o> </o>
End Sub
I have created the macro in order to consolidate sheets only having sheet name june,11 It works fine But I want the macro to select range from A4:A2000 even after giving the ranges it selects the data from A2 I have used both select and activate command but its not working its simple but I am not able to figure it out can anyone help me with this.
Sub x()
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
Dim ws As Worksheet, wsOut As Worksheet, sName As String
<o> </o>
sName = "june'11"
<o> </o>
Set wsOut = Worksheets.Add(after:=Sheets(Sheets.Count))
<o> </o>
For Each ws In Worksheets
If UCase(ws.Name) Like UCase(sName) & "*" Then
ws.Range("A4:A2000", ws.Range("M" & Rows.Count).End(xlUp)).Copy _
wsOut.Range("A" & Rows.Count).End(xlUp)(2)
End If
Next ws
<o> </o>
<o> </o>
<o> </o>
End Sub