Hi Everyone,
I have a script which automaticly hide certain rows and columns, depending on a value, that value references back to a table.
It used to work fine, when i edited one of the numbers myself.
This is the code:
Now what i want, is to past a form in this sheet (which comes in by email) so i don't have to type anything anymore manually.
So in cell C1 i created an If-statement, and it looks like this:
So, when i past the form, C52 is been filled in, and in Cell D1 a number appears (and this still works fine, as you can see in the script numbers 1,2,3,4,5 stand for hiding certain columns and rows) It still searches the right number in a database, but it doesn't perform the script no more.
Maybe a helpful point:
C1 was originally formatted as a text-field, but because i use a formula now, i had to change it to a regular format. But this doesn't seem to affect the vlookup in D1.
I hope someone can help me, if it's unclear let me know.
Regards,
I have a script which automaticly hide certain rows and columns, depending on a value, that value references back to a table.
It used to work fine, when i edited one of the numbers myself.
This is the code:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, [C1]) Is Nothing Then
Rows.Hidden = False
Columns.Hidden = False
Select Case [D1]
Case 2
Rows("6:6").Hidden = True
Rows("7:8").Hidden = True
Rows("11:11").Hidden = True
Rows("13:13").Hidden = True
Columns("K:K").Hidden = True
Columns("M:M").Hidden = True
Case 3
Rows("6:6").Hidden = True
Rows("7:8").Hidden = True
Rows("10:11").Hidden = True
Rows("13:15").Hidden = True
Columns("k:l").Hidden = True
Columns("m:M").Hidden = True
Case 4
Rows("6:6").Hidden = True
Rows("7:8").Hidden = True
Rows("10:11").Hidden = True
Rows("13:15").Hidden = True
Columns("k:l").Hidden = True
Columns("m:M").Hidden = True
Case 5
Rows("10:10").Hidden = True
Rows("13:13").Hidden = True
Case Else
Exit Sub
End Select
End If
End Sub
So in cell C1 i created an If-statement, and it looks like this:
Code:
=IF(C52="","Activiteit",RIGHT(C52,3))
Maybe a helpful point:
C1 was originally formatted as a text-field, but because i use a formula now, i had to change it to a regular format. But this doesn't seem to affect the vlookup in D1.
I hope someone can help me, if it's unclear let me know.
Regards,