Populating last low from button

johnpants

New Member
Joined
Oct 31, 2005
Messages
44
Hi, I have 2 worksheets, and would like the data from s/s 2 to enter into the last row in s/s 1 that has been filled. I can get it to enter into the next empty row, but in this case I want it to enter into the cells I select in the last 'populated' row.

Is this possible? How would I go about this?

Thanks,

John.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

stdz

Active Member
Joined
Sep 1, 2002
Messages
328
Hello John,

If you can get the first empty row, then the last populted row is:

first empty row -1

Ciao,

Don.
 

johnpants

New Member
Joined
Oct 31, 2005
Messages
44
Thank you, I should have thought about that to be honest! Doh!

This is the code I am currently using, but it doesn't actually fill the cell with anything at the minute...

What do I need to change?

Code:
Private Sub CommandButton1_Click()
Sheets("Data").Range("M65536").End(xlUp).Offset(-1, 0) = "I3"
Unload Me
End Sub
[\code]

"I3" is the ceel that I want it to copy from and Column M on worksheet Data is where I would like it to enter on the last used row...

Is this the right type of command?

Thanks,

John.
 

stdz

Active Member
Joined
Sep 1, 2002
Messages
328
Hello John,

Sorry, I've been travelling so couldn't reply before !

This code will put the contents of cell I3 in the last used cell in column M.

Ciao,

Don.

Code:
Private Sub CommandButton1_Click()
Dim lastRow

lastRow = Range("M65536").End(xlUp).Row
Range("M" & lastRow) = Range("I3")

End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,130,167
Messages
5,640,539
Members
417,151
Latest member
ChickenTenderer

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
Top