A little help for the new guy!!

bigkid

New Member
Joined
Mar 10, 2011
Messages
4
Hi guys,

This I'm sure will be the first of plethora of questions... After a little help if anyone can spare any.

I'm creating a bit of a data entry whereby you fill in the fields as you would in Userform textboxes and once "added" the transpose onto the sheet behind. The way it's been set up is that some of the textboxes are on different tabs of a tabpage control.

I'm sure I have the coding wrong but if the first tab nothing was entered, but something was entered in the 2nd or 3rd tab I want it to go to a new line. Instead, it's finding the first available cell and filling in from there.

here's a sample of the code that I think is causing the hassle:

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Understand")
'find first empty row in database
iRow = ws.Cells(Rows.Count) _
.End(xlUp).Offset(1, 0).Row

ws.Cells(iRow, 2).Value = Me.txtMr_s.Value
ws.Cells(iRow, 3).Value = Me.txtforename.Value
ws.Cells(iRow, 4).Value = Me.txtsurname.Value
ws.Cells(iRow, 5).Value = Me.txtpostcode.Value

any help would be greatley appreciated! Thanks again...
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Are you saying that the calculation of iRow is wrong if the previous entry had a blank first field?
 
Upvote 0
Hiya Glenn,

Having a nightmare with what will be the simplest thing...
Imagine the userform has a big multipage tab sheet on it. There's textboxes on the various pages with an add button to add all this data to the worksheet.

Much like:

/Page1\__/Page2\__/Page3\___________

Page 1 - you click the add button and it adds the data to the worksheet in the right fields.

Page 2 - If page 1 is blank I want the data from page 2 to go into a seperate row on the spreadsheet. At the minute it's rewriting the previous row.

Ideally:

_______A ________B_________ C_________D____________ E
MR - John - Doe - blank - blank<BLANK><BLANK>
2¦blank - blank - blank <BLANK> <BLANK><BLANK>Nowheres ville Nowhere town

 
Last edited:
Upvote 0
Have you put a breakpoint in your code to see if iRow is being calculated wrongly?
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,678
Members
452,937
Latest member
Bhg1984

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top