Hi There,
Attached is my Spreadsheet with a very basic userform.
The idea is simple, click on a cell in column "A" and the userform is loaded. Once the information is filled out and the "Submit button" is clicked the information well be sent to designated cells within the workbook.
The problem I'm having is that I can't get the information to send to the same row that is selected. So for example if "A4" is selected, all the information will be sent to the appropriate columns in the same row ("B4", "C4", "D4"), and if "A8" is selected, the information would be sent to "B8, C8, D8) etc... Is this possible to do? If it is, is it then possible to pull out information already in them cells? So for example if there was already text in "C4", the text would be in the related box in the userform.
I apologise if this is confusing. It's easier to see what I'm trying to achieve by looking at the spreadsheet.
Thanks for any help in advance!
Hello revenge4ash89,
Here is the working code for the command button.
Private Sub CommandButton1_Click() Dim iRow As Long Dim Rng As Range Dim ws As Worksheet Set ws = Worksheets("DataSource") Set Rng = ws.Range("A2") iRow = ws.Cells(Rows.Count, Rng.Column).End(xlUp).Row iRow = IIf(iRow < Rng.Row, Rng.Row, iRow + 1) ws.Cells(iRow, 1) = example1.Value ws.Cells(iRow, 2) = example2.Value ws.Cells(iRow, 3) = date1.Value ws.Cells(iRow, 4) = comboexample.Value ws.Cells(iRow, 5) = date1.Value ws.Cells(iRow, 6) = comboexample2.Value ws.Cells(iRow, 7) = example5.Value ws.Cells(iRow, 13) = comboexample3.Value ws.Cells(iRow, 16) = comboexample4.Value ws.Cells(iRow, 16) = comboexample5.Value Unload Me End Sub
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks