mscurtin67
New Member
- Joined
- Aug 12, 2013
- Messages
- 3
I am not a VBA expert but I was able to find a macro which does most, but not all of what I want. I was looking for a macro which would copy data from mutliple worksheets and into single rollup worksheets. Each of the worksheets are formated the same with the same column headings. My problem is that I need the macro to copy paste values and formatting. Currently it is copying the formuals which then dont work on the rollup.
The current macro code is shown below. Any help with how to modify this to allow it work the same but have copy, paste value and formats is appreciated.
Sub Combine()
Application.DisplayAlerts = False
On Error Resume Next
Worksheets("Rollup").Range("A2:AB65536").Clear
On Error GoTo 0
Application.DisplayAlerts = True
Dim ws As Worksheet
' copy headings
Sheets(3).Activate
Range("A5:V5").Select
Selection.Copy Destination:=Sheets(2).Range("A2")
' work through sheets
For Each ws In Worksheets
If ws.Name Like "*ComResp*" Then
ws.Select
Range("A6").Select
Selection.CurrentRegion.Select ' select all cells in this sheets
' select all lines except title
Selection.Offset(2, 0).Resize(Selection.Rows.Count - 1).Select
' copy cells selected in the new sheet on last line
Selection.Copy Destination:=Sheets(2).Range("A65536").End(xlUp)(2)
Sheets(2).Activate
End If
Next
End Sub
The current macro code is shown below. Any help with how to modify this to allow it work the same but have copy, paste value and formats is appreciated.
Sub Combine()
Application.DisplayAlerts = False
On Error Resume Next
Worksheets("Rollup").Range("A2:AB65536").Clear
On Error GoTo 0
Application.DisplayAlerts = True
Dim ws As Worksheet
' copy headings
Sheets(3).Activate
Range("A5:V5").Select
Selection.Copy Destination:=Sheets(2).Range("A2")
' work through sheets
For Each ws In Worksheets
If ws.Name Like "*ComResp*" Then
ws.Select
Range("A6").Select
Selection.CurrentRegion.Select ' select all cells in this sheets
' select all lines except title
Selection.Offset(2, 0).Resize(Selection.Rows.Count - 1).Select
' copy cells selected in the new sheet on last line
Selection.Copy Destination:=Sheets(2).Range("A65536").End(xlUp)(2)
Sheets(2).Activate
End If
Next
End Sub