Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2016-08-26
4
Medium Priority
?
57 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 49

Expert Comment

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

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 32

Expert Comment

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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!
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

721 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