Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using userform, when click - Make information insert in two Rows instead of one

Posted on 2016-08-26
4
Medium Priority
?
59 Views
Last Modified: 2016-08-26
Hy guys, i am trying to find a way to make this userform, once i click on it to write giving information in two rows. not having any luck coding it. First time using Experts Exchange, Thanks for your time and your help.

Row One Having
ws.Cells(iRow, 3).Value = Me.textbox_name.Value
ws.Cells(iRow, 4).Value = Me.textbox_name.Value
ws.Cells(iRow, 5).Value = Range("C2").Value

and

Row Two having
ws.Cells(iRow, 4).Value = Me.textbox_name.Value
ws.Cells(iRow, 5).Value = Range("C2").Value


Original code is underneath this line, if you will need any additional information please feel free to ask. Thanks again
------------------------------------------------------------------------------------------


'find first empty row in database
iRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row

'check for a Name number
If Trim(Me.textbox_name.Value) = "" Then
Me.textbox_name.SetFocus
MsgBox "Please complete the form"
Exit Sub
End If

'copy the data to the database
ws.Cells(iRow, 3).Value = Me.textbox_name.Value
ws.Cells(iRow, 4).Value = Me.textbox_name.Value
ws.Cells(iRow, 5).Value = Range("C2").Value
0
Comment
Question by:Omar Hernandez
  • 2
4 Comments
 
LVL 49

Expert Comment

by:Martin Liss
ID: 41772594
Removed Visual Basic Classic topic.
0
 
LVL 33

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 2000 total points
ID: 41772634
A sample workbook would be helpful.

BTW find the first empty row in the col. D like this.....
iRow = ws.Cells(Rows.Count, 4).End(xlUp).Offset(1, 0).Row

Open in new window


Then you may add the information in the second row like this...
ws.Cells(iRow+1, 4).Value = Me.textbox_name.Value
ws.Cells(iRow+1, 5).Value = Range("C2").Value

Open in new window

If that doesn't help, consider uploading a sample workbook.
0
 

Author Closing Comment

by:Omar Hernandez
ID: 41772657
Thanks Subodh, this did the trick.
0
 
LVL 33

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41772658
You're welcome Omar! Glad it worked for you.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question