SCHEDULE DASHBOARD VBA CODE (AUTOMATCICALLY TOGGLE TO MATCHING COLUMN)

Willkim

New Member
Joined
Apr 12, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello Fellow member,

I'm trying to create my own dashboard to visualize the progress of each shipping project.
On C-Z column, I'm going to manually insert date at each check point, and cells underneath date (starting from AA column) head would then be color-filled.
I want to make progress displays to automatically move to date to match with "C5" cell entry, which will be today's date. I used VBA code as below, but it didn't work.
I freeze "AA8" panes where all date heads begin.

Can anyone help to fix error in following code?


Sub Date_Search()

' Find the last column number in row 7.
Dim endCol As Long
Dim startcell As Range
Dim sht As Worksheet

Set sht = Sheets("schedule")
Set startcell = sht.Range("AA7").Address

endCol = sht.Cells(7, Columns.Count).End(xlToLeft).Column


' Find the value you are looking for
Set lookupvalue = sht.Range("C5").Value


' Select the range you are looking in
Set lookuprange = sht.Range(startcell, sht.Cells(7, endCol).Address).Select


' Find the first matching value, and return the row number
FirstMatchColumnNumber = WorksheetFunction.Match(lookupvalue, lookuprange, 0)


' Go to the applicable row.
sht.Range(8, FirstMatchColumnNumber).Select

End Sub
 

Attachments

  • 2024-04-12 090309.png
    2024-04-12 090309.png
    40.5 KB · Views: 5

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,215,200
Messages
6,123,598
Members
449,109
Latest member
Sebas8956

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