KeithGrindle
New Member
- Joined
- Apr 11, 2002
- Messages
- 5
Hi! I'm new to the list so I hope I do things correctly. If not please bare with me. I have searched the archives but I could only find similar questions and not the answers. I must be doing something wrong.
I would like to programmatically find out if the activecell is within a certain range and if it is I would like other code to execute. Here is the code that I have now. It is failing in the first 3 lines I believe.
Dim Actvcel As Range
Dim WallARange As Range
Dim Width As Double
Set Actvcel = ActiveCell
Set WallARange = Worksheets("Layout").Range("WallA")
If Actvcel.Parent.Parent.Name = WallARange.Parent.Parent.Name Then
If Actvcel.Parent.Name = WallARange.Parent.Name Then
If Union(Actvcel, WallARange).Address = WallARange.Name Then
If Actvcel.Value = "hwt" Or Actvcel = "hwa" Then
Width = InputBox("Please enter the width for this HVAC_
Window", "HVAC Window Width")
i = ActiveCell.Range("WallARange").Rows.Count
Worksheets("Formulas").Range("DO2:DO26").Rows_
(i).Value = Width
End if
End if
End if
End if
Many Thanks in Advance
Keith
I would like to programmatically find out if the activecell is within a certain range and if it is I would like other code to execute. Here is the code that I have now. It is failing in the first 3 lines I believe.
Dim Actvcel As Range
Dim WallARange As Range
Dim Width As Double
Set Actvcel = ActiveCell
Set WallARange = Worksheets("Layout").Range("WallA")
If Actvcel.Parent.Parent.Name = WallARange.Parent.Parent.Name Then
If Actvcel.Parent.Name = WallARange.Parent.Name Then
If Union(Actvcel, WallARange).Address = WallARange.Name Then
If Actvcel.Value = "hwt" Or Actvcel = "hwa" Then
Width = InputBox("Please enter the width for this HVAC_
Window", "HVAC Window Width")
i = ActiveCell.Range("WallARange").Rows.Count
Worksheets("Formulas").Range("DO2:DO26").Rows_
(i).Value = Width
End if
End if
End if
End if
Many Thanks in Advance
Keith