![]() |
Adding to a named range on another worksheet
I hope I can relay my problem cleary
I have 2 worksheets, the first sheet is a form where the user answers a few questions and inputs a lot of data. It looks something like this 104-89-78 MARTIN 02/04/2004 02/01/2004 DEBORA 07-55-20 LEWI 111-21-56 HAMPTO Etc.. Where I am having problems is having the data stored on the "Database" worksheet. I need to keep the focus on the FORM and not be jumping back and forth between the sheets. The "Database" worksheet will have several ranges, each range being named for the day the data is input. ex: Feb_02_200 I can create the range name and save the first row of data but after that I am at a loss. Every time I save the data, it overwrites the previous row, never moving down to the next empty row and updating the range I hope you can understand this Thanks. |
Adding to a named range on another worksheet
"Troy" wrote in message ...
I hope I can relay my problem cleary. I have 2 worksheets, the first sheet is a form where the user answers a few questions and inputs a lot of data. It looks something like this: 104-89-78 MARTIN 02/04/2004 02/01/2004 DEBORAH 07-55-20 LEWIS 111-21-56 HAMPTON Etc... Where I am having problems is having the data stored on the "Database" worksheet. I need to keep the focus on the FORM and not be jumping back and forth between the sheets. The "Database" worksheet will have several ranges, each range being named for the day the data is input. ex: Feb_02_2004 I can create the range name and save the first row of data but after that I am at a loss. Every time I save the data, it overwrites the previous row, never moving down to the next empty row and updating the range. I hope you can understand this. Thanks. Troy, not sure if you mean the form is the worksheet. Or you have a userform displayed? If it's a userform the code below may help you. Private Sub cbadd_Click() Application.ScreenUpdating = False '''This stops the jumping action Dim custrange As Range Dim a As Integer Set custrange = Worksheets("CustData").Cells(2, 1).CurrentRegion For a = 1 To custrange.Rows.Count''this will count to the first empty cell Next a With customerdata''This is my userform name custrange(a, 1).Value = UCase(.tblast.Text) custrange(a, 2).Value = UCase(.tbfirst.Text) custrange(a, 3).Value = .tbphone.Text custrange(a, 4).Value = UCase(.tbstreet.Text) custrange(a, 5).Value = UCase(.tbcity.Text) custrange(a, 6).Value = UCase(.tbstate.Text) custrange(a, 7).Value = .tbzip.Text custrange(a, 8).Value = .tbstartdate.Text custrange(a, 10).Value = .tbjob.Text End With End Sub As they say "HTH" Charles, who likes working with Excel and Learning more everyday. Thanks to all who share their knowledge. |
All times are GMT +1. The time now is 10:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com