FluidPowerOne
New Member
- Joined
- Apr 9, 2013
- Messages
- 2
I'm entirely stunned... I'm working on a method to develop cartesian products via VBA using modeling sequences for hydraulic compentry. Long story short, when I build macros, I test them with debug.print along the way to ensure Excel is accepting all my inputs.
Why.... is... this... not... working when I have had it work before? This macro sits in it's own module, and there is NO other coding anywhere else in the workbook. Why am I getting a Run-Time error 438 stating that this won't work, when I see absolutely nothing wrong with the way this is written. it's like, Excel suddenly doesn't recognize the word "range".
Sub Cartesian()
Dim wb As Workbook: Set wb = ThisWorkbook
Dim ws As Worksheet: Set ws = wb.Worksheets("Cartesian")
Dim aRng As Range
Set aRng = wb.ws.Range("A1")
Debug.Print aRnge.Address
Debug.Print wb.Name
Debug.Print ws.Name
End Sub
Why.... is... this... not... working when I have had it work before? This macro sits in it's own module, and there is NO other coding anywhere else in the workbook. Why am I getting a Run-Time error 438 stating that this won't work, when I see absolutely nothing wrong with the way this is written. it's like, Excel suddenly doesn't recognize the word "range".
Sub Cartesian()
Dim wb As Workbook: Set wb = ThisWorkbook
Dim ws As Worksheet: Set ws = wb.Worksheets("Cartesian")
Dim aRng As Range
Set aRng = wb.ws.Range("A1")
Debug.Print aRnge.Address
Debug.Print wb.Name
Debug.Print ws.Name
End Sub