G
Guest
Is there a limit to the size of sub procedure? I am receiving an error for
my procedure being too large.
I need to have cells, call them K1-3 and T1-3, change depeding on what cell
is currently selected. I have a square of cells 31 x 72 for a total of 1,147
possibilities. I have only completed the third column and have already
recieved the error. My code works for two columns but no more. Here is a
sample of what I am doing, please let me know if there is more a way around
this or a different way of performing this function.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'1st of the Month
'Room 1 on the 1st
If Target.Address = ("$B$8") Then Range("K1").Value =
Worksheets("Detail").Range("B4").Value
If Target.Address = ("$B$8") Then Range("K2").Value =
Worksheets("Detail").Range("B5").Value
If Target.Address = ("$B$8") Then Range("K3").Value =
Worksheets("Detail").Range("B6").Value
If Target.Address = ("$B$8") Then Range("T1").Value =
Worksheets("Detail").Range("B7").Value
If Target.Address = ("$B$8") Then Range("T2").Value =
Worksheets("Detail").Range("B8").Value
If Target.Address = ("$B$8") Then Range("T3").Value =
Worksheets("Detail").Range("B9").Value
'Room 2 on the 1st
If Target.Address = ("$B$9") Then Range("K1").Value =
Worksheets("Detail").Range("B13").Value
If Target.Address = ("$B$9") Then Range("K2").Value =
Worksheets("Detail").Range("B14").Value
If Target.Address = ("$B$9") Then Range("K3").Value =
Worksheets("Detail").Range("B15").Value
If Target.Address = ("$B$9") Then Range("T1").Value =
Worksheets("Detail").Range("B16").Value
If Target.Address = ("$B$9") Then Range("T2").Value =
Worksheets("Detail").Range("B17").Value
If Target.Address = ("$B$9") Then Range("T3").Value =
Worksheets("Detail").Range("B18").Value
Joe
my procedure being too large.
I need to have cells, call them K1-3 and T1-3, change depeding on what cell
is currently selected. I have a square of cells 31 x 72 for a total of 1,147
possibilities. I have only completed the third column and have already
recieved the error. My code works for two columns but no more. Here is a
sample of what I am doing, please let me know if there is more a way around
this or a different way of performing this function.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'1st of the Month
'Room 1 on the 1st
If Target.Address = ("$B$8") Then Range("K1").Value =
Worksheets("Detail").Range("B4").Value
If Target.Address = ("$B$8") Then Range("K2").Value =
Worksheets("Detail").Range("B5").Value
If Target.Address = ("$B$8") Then Range("K3").Value =
Worksheets("Detail").Range("B6").Value
If Target.Address = ("$B$8") Then Range("T1").Value =
Worksheets("Detail").Range("B7").Value
If Target.Address = ("$B$8") Then Range("T2").Value =
Worksheets("Detail").Range("B8").Value
If Target.Address = ("$B$8") Then Range("T3").Value =
Worksheets("Detail").Range("B9").Value
'Room 2 on the 1st
If Target.Address = ("$B$9") Then Range("K1").Value =
Worksheets("Detail").Range("B13").Value
If Target.Address = ("$B$9") Then Range("K2").Value =
Worksheets("Detail").Range("B14").Value
If Target.Address = ("$B$9") Then Range("K3").Value =
Worksheets("Detail").Range("B15").Value
If Target.Address = ("$B$9") Then Range("T1").Value =
Worksheets("Detail").Range("B16").Value
If Target.Address = ("$B$9") Then Range("T2").Value =
Worksheets("Detail").Range("B17").Value
If Target.Address = ("$B$9") Then Range("T3").Value =
Worksheets("Detail").Range("B18").Value
Joe