I have this code:
I know there should be a better way to write it.
The other problem is how do I copy that formula after copying and pasting the values from the RawData worksheet to enable the formula to see the new values?
Code:
Sub CopyPastefoo2()
'
' CopyPastefoo2 Macro
'
'
Sheets("RawData").Select
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Sheets("DataCalcs").Select
Range("AF2").Select
Range("AF2").Formula = "=IF('RawData Old1'!A2=0,""Base Bid"", ""Alternate - "" & 'RawData Old1'!A2)"
ActiveSheet.Paste
Range("B2").Select
Range(Selection, Selection.End(xlDown)).Select
Sheets("RawData").Select
Selection.Copy
Sheets("DataCalcs").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Sheets("RawData").Select
Range("C2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("DataCalcs").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Sheets("RawData").Select
Range("D2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("DataCalcs").Select
Range("C2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Sheets("RawData").Select
Range("E2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("DataCalcs").Select
Range("D2").Select
ActiveSheet.Paste
Range("D2").Select
Application.CutCopyMode = False
Sheets("RawData").Select
Range("F2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("DataCalcs").Select
Range("E2").Select
ActiveSheet.Paste
Range("E2").Select
Application.CutCopyMode = False
Sheets("RawData").Select
Range("G2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("DataCalcs").Select
Range("F2").Select
ActiveSheet.Paste
Range("F2").Select
Application.CutCopyMode = False
Sheets("RawData").Select
Range("H2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("DataCalcs").Select
Range("G2").Select
ActiveSheet.Paste
Sheets("DataCalcs").Select
Range("G2").Select
Application.CutCopyMode = False
Sheets("RawData").Select
Range("I2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("DataCalcs").Select
Range("H2").Select
ActiveSheet.Paste
Range("H2").Select
Application.CutCopyMode = False
Sheets("RawData").Select
Range("J2").Select
Range(Selection, Selection.End(xlDown)).Select
Range("J2").Select
Range(Selection, Selection.End(xlDown)).Select
Range("K2").Select
Sheets("DataCalcs").Select
Range("J2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Application.CutCopyMode = False
Range("J2").Select
Sheets("RawData").Select
Range("K2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("DataCalcs").Select
ActiveSheet.Paste
Range("J2").Select
Application.CutCopyMode = False
Sheets("RawData").Select
Range("L2").Select
Range(Selection, Selection.End(xlDown)).Select
Range("L2:L29089").Select
Selection.Copy
Sheets("DataCalcs").Select
Range("K2").Select
ActiveSheet.Paste
Range("K2").Select
Application.CutCopyMode = False
Sheets("RawData").Select
Range("M2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("DataCalcs").Select
Range("L2").Select
ActiveSheet.Paste
Range("L2").Select
Application.CutCopyMode = False
Sheets("RawData").Select
Range("N2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("DataCalcs").Select
Range("M2").Select
ActiveSheet.Paste
Range("M2").Select
Application.CutCopyMode = False
Sheets("RawData").Select
Range("O2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("RawData").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("DataCalcs").Select
Range("N2").Select
ActiveSheet.Paste
Sheets("RawData").Select
Range("O2").Select
Application.CutCopyMode = False
Range("P2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("DataCalcs").Select
Range("O2").Select
ActiveSheet.Paste
Range("O2").Select
Application.CutCopyMode = False
Sheets("RawData").Select
Range("Q2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("DataCalcs").Select
Range("P2").Select
ActiveSheet.Paste
Range("P2").Select
Application.CutCopyMode = False
Sheets("RawData").Select
Range("R2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("DataCalcs").Select
Range("Q2").Select
ActiveSheet.Paste
Range("Q2").Select
Application.CutCopyMode = False
Sheets("RawData").Select
Range("S2").Select
Range(Selection, Selection.End(xlDown)).Select
Range("S2:S29089").Select
Selection.Copy
Sheets("DataCalcs").Select
Range("R2").Select
ActiveSheet.Paste
Range("R2").Select
Application.CutCopyMode = False
End Sub
I know there should be a better way to write it.
The other problem is how do I copy that formula after copying and pasting the values from the RawData worksheet to enable the formula to see the new values?
Last edited by a moderator: