VBaA - Scroll Bars to change date in a cell

tdigby1

New Member
Joined
Oct 9, 2014
Messages
2
Hi

Bit of a novice at VBA so any help anyone can give me would be very much appreciated.

I am trying to add a scrollbar to a spreadsheet that changes a date in a cell. I have managed to fix the bar to cell to change the date however I need to have a range of 31/01/2012 fixed as the minimum and maximum as today's date. Hopefully so that every day the spreadsheet is open the range will thus increase itself automatically to include the current date as well as allowing the user to set the date of that cell.

Any help would be much appreciated.

Kind Regards

T
 

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Momentman

Well-known Member
Joined
Jan 11, 2012
Messages
4,040
Office Version
  1. 365
Platform
  1. Windows
WELCOME TO THE FORUM

I think you just need one life which might be in the worksheet_activate or worksheet_calculate event, so once that sheet is activated, the code runs and sets the Maximum value for the scrollbar

For example, if the crollbar is in sheet1, right click Sheet1, select "View code" and paste this code in there
Code:
Private Sub Worksheet_Activate()
    ScrollBar1.Max = Format(Date, "#")
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,109,518
Messages
5,529,311
Members
409,862
Latest member
lbisacca
Top