Next and Previous

stirlingmw

Board Regular
Joined
Feb 18, 2013
Messages
75
Afternoon all
I am using the code below to populate a Userform from data held on "Project Master" Worksheet. I am trying to add a command button to transition to previous and next rows, but for some reason the code i tried either jumped me to the header row (row 1) of the "Project Master" worksheet or just did nothing. I have since deleted that code to try again.

Can you help.

Code:
totRows = Worksheets("Project Master").Range("A1").CurrentRegion.Rows.count
For i = 2 To totRows
    If Trim(Worksheets("Project Master").Cells(i, 1)) = Trim(CmbFindProject.text) Then
TxtProject.text = Worksheets("Project Master").Cells(i, 1).value
CmbTeam.text = Worksheets("Project Master").Cells(i, 2).value
CmbCDTLead.text = Worksheets("Project Master").Cells(i, 3).value
TxtDESTeam.text = Worksheets("Project Master").Cells(i, 4).value
.etc....

regards

Steve
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
try

totRows = Worksheets("Project Master").Cells(Rows.Count, "A").End(xlUp).Row

hth,

Ross
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,164
Members
453,021
Latest member
Justyna P

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