Hello,
I'm hoping someone can help me out with this code. I'm new to VBA and trying to figure it out. I got the code to work for the first cell to copy down column A but can't get it to do the same for the next column of data. Any help is greatly appreciated. Here is my code, I've highlighted the trouble area in red. Thank you!!!
Dim a As Integer
Dim we As Date
a = Sheets("history tab").Range("c" & Rows.Count).End(xlUp).Row + 1
b = Sheets("history tab").Range("a" & Rows.Count).End(xlUp).Row + 1
we = Sheets("history tab").Range("g" & Rows.Count).End(xlUp).Row + 1
ActiveSheet.Range("b6:f20").Copy
Sheets("History Tab").Range("b" & a).PasteSpecial xlPasteValues
ActiveSheet.Range("b2").Copy
Sheets("History Tab").Range("A" & b).PasteSpecial xlPasteValues
With Sheets("History Tab")
lastrow = .Range("c" & Rows.Count).End(xlUp).Row
Do
Set c = .Columns(1).Find("", after:=.[A3], LookIn:=xlValues)
If c Is Nothing Or c.Row > lastrow Then Exit Do
c.Value = c.Offset(-1).Value
Loop
End With
ActiveSheet.Range("d3").Copy
Sheets("History Tab").Range("g" & we).PasteSpecial xlPasteValues
With Sheets("History Tab")
lastrow = .Range("a" & Rows.Count).End(xlUp).Row
Do
Set d = .Columns(1).Find("", after:=.[g3], LookIn:=xlValues)
If d Is Nothing Or d.Row > lastrow Then Exit Do
d.Value = d.Offset(-2).Value
Loop
End With
ActiveSheet.Range("b6:e20").ClearContents
ActiveSheet.Range("b6").Select
Sheets("History List").PivotTables("HistoryList").RefreshTable
End Sub
I'm hoping someone can help me out with this code. I'm new to VBA and trying to figure it out. I got the code to work for the first cell to copy down column A but can't get it to do the same for the next column of data. Any help is greatly appreciated. Here is my code, I've highlighted the trouble area in red. Thank you!!!
Dim a As Integer
Dim we As Date
a = Sheets("history tab").Range("c" & Rows.Count).End(xlUp).Row + 1
b = Sheets("history tab").Range("a" & Rows.Count).End(xlUp).Row + 1
we = Sheets("history tab").Range("g" & Rows.Count).End(xlUp).Row + 1
ActiveSheet.Range("b6:f20").Copy
Sheets("History Tab").Range("b" & a).PasteSpecial xlPasteValues
ActiveSheet.Range("b2").Copy
Sheets("History Tab").Range("A" & b).PasteSpecial xlPasteValues
With Sheets("History Tab")
lastrow = .Range("c" & Rows.Count).End(xlUp).Row
Do
Set c = .Columns(1).Find("", after:=.[A3], LookIn:=xlValues)
If c Is Nothing Or c.Row > lastrow Then Exit Do
c.Value = c.Offset(-1).Value
Loop
End With
ActiveSheet.Range("d3").Copy
Sheets("History Tab").Range("g" & we).PasteSpecial xlPasteValues
With Sheets("History Tab")
lastrow = .Range("a" & Rows.Count).End(xlUp).Row
Do
Set d = .Columns(1).Find("", after:=.[g3], LookIn:=xlValues)
If d Is Nothing Or d.Row > lastrow Then Exit Do
d.Value = d.Offset(-2).Value
Loop
End With
ActiveSheet.Range("b6:e20").ClearContents
ActiveSheet.Range("b6").Select
Sheets("History List").PivotTables("HistoryList").RefreshTable
End Sub