Chewyhairball
Active Member
- Joined
- Nov 30, 2017
- Messages
- 312
- Office Version
- 365
- Platform
- Windows
Hi
I have a range of cells Sheet1 C7:C1000 that autofit the row height when the data in those cells is changed.
The data is pulled from another sheet and updates when I type certain criteria into a combobox.
It works great and when more text is pulled through it automatically changes the the row height as I am typing in the combobox.
The VBA i have is a Worksheet_Calculate but i have found that it also tries to run if i am on other sheets and change C7:C1000 on them.
I thought putting the event in the specific sheet would mean it only ran on that sheet but its not the case.
I tried a Worksheet Change but that doesnt give me what i need as it required a <return> and thats not how my sheet runs. I use the combobox and it changes the data in the rows as i type.
Any ideas how I can keep my code but only have it run on the one sheet. Thanks
I have a range of cells Sheet1 C7:C1000 that autofit the row height when the data in those cells is changed.
The data is pulled from another sheet and updates when I type certain criteria into a combobox.
It works great and when more text is pulled through it automatically changes the the row height as I am typing in the combobox.
The VBA i have is a Worksheet_Calculate but i have found that it also tries to run if i am on other sheets and change C7:C1000 on them.
I thought putting the event in the specific sheet would mean it only ran on that sheet but its not the case.
I tried a Worksheet Change but that doesnt give me what i need as it required a <return> and thats not how my sheet runs. I use the combobox and it changes the data in the rows as i type.
Any ideas how I can keep my code but only have it run on the one sheet. Thanks
VBA Code:
Private Sub Worksheet_Calculate()
Dim Xrg As Range
Set Xrg = Range("C7:C1000")
If Not Intersect(Xrg, Range("C7:C1000")) Is Nothing Then
rowheight
End If
End Sub