ariel20029
Board Regular
- Joined
- Jun 20, 2013
- Messages
- 97
Hi, I have a workbook with 4 spreadsheets- Finance1, FixedFee,T&M,Basic.
I need to copy columns A&B from Finance1 from to the supporting spreadsheets based on the Type in column C ( FixedFee,T&M,Basic)- fixed fee would be copied on FixedFee tab,T&M on the T&M tab and Basic on basic tab.
I found this code, but I don't know how to do this.
One other wrinkle the data starts on row 6 on each sheet due to headers- I don't know if that matters.
Sub Macro1()
'
Dim LastRow As Integer, i As Integer, erow As Integer
LastRow = ActiveSheet.Range(“C” & Rows.Count).End(xlUp).Row
For i = 2 To LastRow
If Cells(i, 1) = Date And Cells(i, 2) = “FixedFee” Then
Range(Cells(i, 1), Cells(i, 7)).Select
Selection.Copy
Worksheets(“FixedFee”).Select
erow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
ActiveSheet.Cells(erow, 1).Select
ActiveSheet.Paste
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.CutCopyMode = False
End If
'
End Sub
Thanks for your help...:
I need to copy columns A&B from Finance1 from to the supporting spreadsheets based on the Type in column C ( FixedFee,T&M,Basic)- fixed fee would be copied on FixedFee tab,T&M on the T&M tab and Basic on basic tab.
I found this code, but I don't know how to do this.
One other wrinkle the data starts on row 6 on each sheet due to headers- I don't know if that matters.
Sub Macro1()
'
Dim LastRow As Integer, i As Integer, erow As Integer
LastRow = ActiveSheet.Range(“C” & Rows.Count).End(xlUp).Row
For i = 2 To LastRow
If Cells(i, 1) = Date And Cells(i, 2) = “FixedFee” Then
Range(Cells(i, 1), Cells(i, 7)).Select
Selection.Copy
Worksheets(“FixedFee”).Select
erow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
ActiveSheet.Cells(erow, 1).Select
ActiveSheet.Paste
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.CutCopyMode = False
End If
'
End Sub
Thanks for your help...: