![]() |
Enter data in next available row
What is the syntax for putting text entered in a userform(or cell or
whatever) into the next available row in a sheet, so that it forms a database of sorts? Thanks to all. |
Enter data in next available row
Take a look at how Debra Dalgleish approached it:
http://www.contextures.com/xlUserForm01.html michaelberrier wrote: What is the syntax for putting text entered in a userform(or cell or whatever) into the next available row in a sheet, so that it forms a database of sorts? Thanks to all. -- Dave Peterson |
Enter data in next available row
Dave,
Is there a way to adapt Debra's code : iRow = ws.Cells(Rows.Count, 1) _ .End(xlUp).Offset(1, 0).Row to allow data to be entered into the same row in a different column if that interesection is empty. For example, if you maintain two databases on the same sheet, one in Col A-C and the next in Col D-F. I tried setting a seperate Dim and using a greater offset, but it didn't do what I was hoping. Thanks. Dave Peterson wrote: Take a look at how Debra Dalgleish approached it: http://www.contextures.com/xlUserForm01.html michaelberrier wrote: What is the syntax for putting text entered in a userform(or cell or whatever) into the next available row in a sheet, so that it forms a database of sorts? Thanks to all. -- Dave Peterson |
Enter data in next available row
I'm not sure...
dim iRowUse as long Dim iRowA as long dim iRowD as long with ws irowa = .cells(.rows.count,"A").end(xlup).row + 1 irowD = .cells(.rows.count,"D").end(xlup).row + 1 end with if irowa irowd then irowuse = irowa else irowuse = irowd end if 'then use irowuse in your formulas. Or if you want to loop through all the columns... dim iCol as long dim iRow as long dim cRow as long 'current column's last row irow = 0 for icol = 1 to 6 'A to F crow = .cells(.rows.count,icol).row if crow irow then irow = crow end if next icol 'come down one row irow = irow + 1 ...... michaelberrier wrote: Dave, Is there a way to adapt Debra's code : iRow = ws.Cells(Rows.Count, 1) _ .End(xlUp).Offset(1, 0).Row to allow data to be entered into the same row in a different column if that interesection is empty. For example, if you maintain two databases on the same sheet, one in Col A-C and the next in Col D-F. I tried setting a seperate Dim and using a greater offset, but it didn't do what I was hoping. Thanks. Dave Peterson wrote: Take a look at how Debra Dalgleish approached it: http://www.contextures.com/xlUserForm01.html michaelberrier wrote: What is the syntax for putting text entered in a userform(or cell or whatever) into the next available row in a sheet, so that it forms a database of sorts? Thanks to all. -- Dave Peterson -- Dave Peterson |
All times are GMT +1. The time now is 08:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com