Userform textbox update based on combobox selection

Adam88

New Member
Joined
Dec 12, 2017
Messages
16
Hi Everyone,
I was hoping someone could help me with an issue I'm having on my Userform;

Userform = frmWeeklyWages
Combobox = cbbWeekEnding (Row source is Column "R" from "Formulas" worksheet)
TextBox = txtWeek

I would like to select a week (displayed as a date) from the combobox, then based on my selection, update the Textbox to show the financial week number (which is Column "Q" in "Formulas" worksheet, so Offset 0, -1? )

My current best attempt so far is;

Code:
Private Sub cbbWeekEnding_Change()

  Dim Found As Range, LastRow As Long
  cbbWeekEnding.Value = Format(cbbWeekEnding, "dd/mm/yyyy")
  Set Found = Worksheets("Formulas").Columns(18).Find(what:=frmWeeklyWages.cbbWeekEnding.Value, LookIn:=xlValues, lookat:=xlWhole) 
  If Found Is Nothing Then Exit Sub
  Me.txtWeek.Text = Worksheets("Formulas").Cells(Found.Row, Found.Column).Offset(0, -1).Value

This at least allows me to select the date, but it isn't updating the textbox? Im very new to VBA so hoping your more experienced eyes can spot the issue! Thanks
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
What happens if you try this
Code:
Private Sub cbbWeekEnding_Change()

Dim Found As Range, LastRow As Long
cbbWeekEnding.Value = Format(cbbWeekEnding, "dd/mm/yyyy")
Set Found = Worksheets("Formulas").Columns(18).Find(what:=frmWeeklyWages.cbbWeekEnding.Value, LookIn:=xlValues, lookat:=xlWhole)
If Found Is Nothing Then
   MsgBox "Nothing found"
   Exit Sub
End If
Me.txtWeek.Text = Found.Offset(0, -1).Value
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,356
Members
449,080
Latest member
Armadillos

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