Userform Help Please

jay111

New Member
Joined
Nov 7, 2009
Messages
2
Hi All,

I am new to this forum so apologies.

I was wondering if anyone could offer me some assistance / point me in the right direction.

Basically I would like display certain data from a given row in a spreadsheet via a userform which can be opened via a command button and take the required information from the row the user is clicked.

I.e. if the user is in row 2 then the relevant information from that row will be displayed.

Any chance of some assistance ????

Many thanks in advance,

J
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi,

I have been playing around with forms all day so have a few bits and pieces.

Say that the sheet containing all the data = sheet1.

Once I have a form wanting to display say "name", "age", "Height" how do I take the information from sheet1 and put in the relevant place on the form ???

Any help would be great.
 
Upvote 0
Hi Jay.

I'm posting this code with a disclaimer that i can't explain how it works. :-) .. its from one of the many board members who helped me with my latest userform.

Hope you can adapt it.. or one of the others here :bow: can assist if not . Chuf

Code:
Private Sub cmbEdit_Click()
Dim varMatch
Application.ScreenUpdating = False
With Sheets("ABC Recharge")
varMatch = Application.Match(Me.txtRil, .Range("F:F"), 0)
If IsError(varMatch) Then
   MsgBox "Ref ID not found"
Else
   Me.cboTeamr = .Cells(varMatch, "A").Value
   Me.txtMan = .Cells(varMatch, "B").Value
   Me.txtVac = .Cells(varMatch, "C").Value
   Me.txtPub = .Cells(varMatch, "D").Value
   Me.txtDat = Format(.Cells(varMatch, "E").Value, "dd/mm/yy")
   Me.txtRef = .Cells(varMatch, "F").Value
   Me.txtFin = .Cells(varMatch, "G").Value
   Me.txtCos = Format(.Cells(varMatch, "H").Value, "###0.00")
 End If
End With
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Hi Jay,

Try this code if you find the match function won't work


Code:
Private Sub cmbEdit_Click()
Dim MyRow As Integer
Dim LastRow As Integer
Dim MySheet As String
  
Application.ScreenUpdating = False
 
MySheet = "ABC Recharge"
LastRow = 1000 ' will look for MyRow as far as row 1000
MyRef = Me.txtRil
 
' start to look in each cell in Column F for MyRow
For i = 1 To LastRow
If Sheets(MySheet).Range("F" & i).Value = MyRef Then
MyRow = i
Else
End If
If MyRow > 0 Then GoTo EndLoop
Next i
 
EndLoop:
 
'Check a match was found
If MyRow = 0 Then
MsgBox "Ref ID not found"
Exit Sub
Else
 
End If
 
Me.cboTeamr = Sheets("ABC Recharge").Cells(MyRow, 1).Value
Me.txtMan = .Cells(MyRow, 2).Value
Me.txtVac = .Cells(MyRow, 3).Value
Me.txtPub = .Cells(MyRow, 4).Value
Me.txtDat = Format(.Cells(MyRow, 5).Value, "dd/mm/yy")
Me.txtRef = .Cells(MyRow, 6).Value
Me.txtFin = .Cells(MyRow, 7).Value
Me.txtCos = Format(.Cells(MyRow, 8).Value, "###0.00")
 
 Application.ScreenUpdating = True
End Sub
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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