rikeezzein
New Member
- Joined
- Nov 21, 2020
- Messages
- 1
- Office Version
- 365
- 2019
- Platform
- Windows
For the example of my problem, I have a worksheet with a list of football teams on one sheet. On the next sheet is a dropdown list of these teams. There are around 20 total dropdowns that could be filled. Next to each dropdown are checkboxes in columns representing "First," "Second," and "Third." On the third sheet, each team has a column for all three options i.e. Raiders First, Raiders Second, and Raiders Third.
What I have been trying to accomplish is having all of these columns hidden by default, then (for example) the "Raiders Second" column unhidden if a dropdown of "Raiders" is selected with the checkbox in the same row, under the "Second" column marked as TRUE.
The closest I've been able to get before I'm completely overwhelmed is below. And I know there's a good chance that this isn't even on the right path. I am only three days into knowing VBA exists, so take pity!
--------------------------------------------------------------------------
Dim r As Integer, c As Integer, LastCell As Integer
Set LastRow = 22
Set r = 2 to LastRow
Set c = 1
IF sheet4.(r, c) <> “” AND <> “Choose Carrier”, AND IF (r, (c + 1)) = TRUE, then the column on sheet1 with the value of “(r, c) + FIRST” on row 2 is unhidden
IF sheet4.(r, c) <> “” AND <> “Choose Carrier”, AND IF (r, (c + 2)) = TRUE, then the column on sheet1 with the value of “(r, c) + INCREASE” on row 2 is unhidden
IF sheet4.(r, c) <> “” AND <> “Choose Carrier”, AND IF (r, (c + 3)) = TRUE, then the column on sheet1 with the value of “(r, c) + FINAL” on row 2 is unhidden
r = r + 1
------------------------------------------------------------------------------
What I have been trying to accomplish is having all of these columns hidden by default, then (for example) the "Raiders Second" column unhidden if a dropdown of "Raiders" is selected with the checkbox in the same row, under the "Second" column marked as TRUE.
The closest I've been able to get before I'm completely overwhelmed is below. And I know there's a good chance that this isn't even on the right path. I am only three days into knowing VBA exists, so take pity!
--------------------------------------------------------------------------
Dim r As Integer, c As Integer, LastCell As Integer
Set LastRow = 22
Set r = 2 to LastRow
Set c = 1
IF sheet4.(r, c) <> “” AND <> “Choose Carrier”, AND IF (r, (c + 1)) = TRUE, then the column on sheet1 with the value of “(r, c) + FIRST” on row 2 is unhidden
IF sheet4.(r, c) <> “” AND <> “Choose Carrier”, AND IF (r, (c + 2)) = TRUE, then the column on sheet1 with the value of “(r, c) + INCREASE” on row 2 is unhidden
IF sheet4.(r, c) <> “” AND <> “Choose Carrier”, AND IF (r, (c + 3)) = TRUE, then the column on sheet1 with the value of “(r, c) + FINAL” on row 2 is unhidden
r = r + 1
------------------------------------------------------------------------------