Next empty row in table

tdeitrick

New Member
Joined
Jun 2, 2011
Messages
5
I am having trouble writting the code that after I press an Active X control button in sheet 1 it will take the value of cell A2 in sheet 1 and place it in the next empty row in a table on sheet 2. Sheet one is acting almost like a user form.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
What have you tried so far? Post your code.
 
Upvote 0
I appologize about being vauge in my first post. I am trying to make a flat labor data base that groups regular hours and overtime hours with the event and the employee that worked it along with some other details. This is what I have so far. I know once I can get A2 to go to the right place the rest of my coding will be, hopefully downhill from here. Every time I test it it skips a row or places a2 value outside the table. I appreciate all of your help
Thank you,
Todd D.

Dim ts As Worksheet
Set ts = Worksheets("TimeSheet")
Dim lt As Worksheet
Set lt = Worksheets("LaborTable")
Dim newrow As Long
newrow = lt.Range("a50000").End(xlUp).Row + 1
lt.Cells(newrow, 1).Value = ts.Range("a2").Value
 
Upvote 0
As far as I can see, as long as Worksheets("LaborTime") column A is populated on every row ( i.e. the last row of the table has column A as a non-blank entry ), and that column A cells after the end of the data area really are blank, then your code should work. Are those things true about your table?
 
Upvote 0
I belive so. When i test the code I have a empty table aside from the column headers. I press the button to execute the code three times. It skips the first blank row of the table and place a2's values in the first blank row below the table. I then manually resize the table to encompass the the three values. Then test it three more times. The data skips a row but otherwise places it corectly inside the table. Weird Huh??
 
Upvote 0
Why does it have to be a "Table" instead of a range?
 
Upvote 0
the table will eventually contain a few thousand rows of data that I sort, filter and produce lots of diffrent pivot reports and charts from. Also, I plan to export the table to an Acess data base.
 
Upvote 0
All of that can be done without it being an Excel Table.
 
Upvote 0

Forum statistics

Threads
1,224,607
Messages
6,179,871
Members
452,948
Latest member
UsmanAli786

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