Row count base on one column

Soma88

New Member
Joined
Oct 20, 2014
Messages
3
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
 
Welcome to MrExcel.

Maybe:

Code:
With Worksheets("Projectname")
    RowCount = .Range("F" & .Rows.Count).End(xlUp).Row
End With
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top