Help with combobox full with dates

ColdGeorge

Active Member
Joined
Aug 21, 2012
Messages
389
Office Version
  1. 2016
Platform
  1. Windows
Hi all
I have a userform with a combobox populated with following code

VBA Code:
Private Sub UserForm_Initialize()
Dim rango, celda As Range
Set rango = Worksheets("actividad").Range("R75:R105")
For Each celda In rango
ComboBox1.AddItem celda.Value
Next celda
End Sub

Range R75:R105 is full with dates (dd/mm/yyyy), what I want to do is that when I click on a date of the combobox, for instance 01/01/2021 and when I hit the button Go. Select the cell having same date (01/01/2021). Any help will be appreciated.

ColdGeorge
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,241
Office Version
  1. 365
Platform
  1. Windows
How about
VBA Code:
Private Sub UserForm_Initialize()
   Me.ComboBox1.list = Sheets("actividad").Range("R75:R105").Value
End Sub
and in your button code
VBA Code:
   Range("R" & Me.ComboBox1.ListIndex + 75).Select
 
Solution

ColdGeorge

Active Member
Joined
Aug 21, 2012
Messages
389
Office Version
  1. 2016
Platform
  1. Windows
Hi Fluff

It did work, thanks again.

ColdGeorge
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,241
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,126,972
Messages
5,621,892
Members
415,864
Latest member
cybid

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
Top