Dear everyone,
I have a macro which copies data to a main excel to the last unfilled row. The code is the following:
Private Sub CommandButton1_Click()
Dim dt As String
Dim sc As String
Worksheets("migrate").Select
dt = Range("A2")
sc = Range("B2")
Set myData = Workbooks.Open("D:\Migrate_trial\TimeTracker_migrate.xls")
Worksheets("ProjectName").Select
Worksheets("ProjectName").Range("F1").Select
RowCount = Worksheets("Projectname").Range("F1").CurrentRegion.Rows.Count
With Worksheets("Projectname").Range("F1")
.Offset(RowCount, 0) = dt
.Offset(RowCount, 1) = sc
End With
myData.Save
End Sub
It works fine but in this case the row count is based on every cell of a row. What I need is to count the rows only based on one column, (wether it is filled or not) and then insert the data into the last row based on that single column. Any advices how to do that?
Many thanks in advance
I have a macro which copies data to a main excel to the last unfilled row. The code is the following:
Private Sub CommandButton1_Click()
Dim dt As String
Dim sc As String
Worksheets("migrate").Select
dt = Range("A2")
sc = Range("B2")
Set myData = Workbooks.Open("D:\Migrate_trial\TimeTracker_migrate.xls")
Worksheets("ProjectName").Select
Worksheets("ProjectName").Range("F1").Select
RowCount = Worksheets("Projectname").Range("F1").CurrentRegion.Rows.Count
With Worksheets("Projectname").Range("F1")
.Offset(RowCount, 0) = dt
.Offset(RowCount, 1) = sc
End With
myData.Save
End Sub
It works fine but in this case the row count is based on every cell of a row. What I need is to count the rows only based on one column, (wether it is filled or not) and then insert the data into the last row based on that single column. Any advices how to do that?
Many thanks in advance