Solved

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

Posted on 2016-08-26
4
46 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 46

Expert Comment

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

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 500 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 29

Expert Comment

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

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

803 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