Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have code in a worksheet to expand the next column when an entry is made,
or to contract the column when an entry is deleted. It all works properly, but every time the entry in (say) "H34" changes and the macro expands COLUMN "J" it also checks through all of the others (there'll be 40 in all, so it's quite tiresome to watch). Furthermore every time I enter data into any cell on the sheet it goes through its checking routine. How can I get it to do just the one next column when "H34" changes, and not do its check when I enter data in other cells? By the way, my preference was actually to hide/unhide the next column, but that was way too jumpy. I then changed it to just shrink the column right down but it's still not good to watch and use. A sample of the code is as follows (there are 40 of these "With" statements) Private Sub Worksheet_Change(ByVal Target As Range) With Target If Range("H34") "0" Then Columns("I").ColumnWidth = 25 ElseIf Range("H34") < "1" Then Columns("I").ColumnWidth = 0.5 End If End With With Target If Range("I34") "0" Then Columns("J").ColumnWidth = 25 ElseIf Range("I34") < "1" Then Columns("J").ColumnWidth = 0.5 End If End With Thankyou for your time and brain. Regards, Brett. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Private Sub Workbook_Open() doesn't run | Excel Discussion (Misc queries) | |||
Private Sub CommandButton1_Click() | Excel Discussion (Misc queries) | |||
Removal of Private Information | Excel Discussion (Misc queries) | |||
Common Private Sub | Excel Discussion (Misc queries) | |||
Private sub | New Users to Excel |