-
I don't have the help file on my machine, and it's been awhile since I've done this. How do I set the range property?
For example
Dim MyRange as Range
MyRange = Activecell.range
This doesn't work because it wants more parameters for the range property.
I also tried Range(activecell), but that didn't work either.
Thanks,
LauRa
-
Hi,
You could try, MyRange = ActiveWindow.Selection
Hope this helps!
-
That didn't work, but thanks anyway. It appears that the selection property actually takes the value of the cell instead of the range.
LauRa
-
Try something like this:
MyRange = range("A1:C1")
-
I need it to be a little more general.
-
You can pass variable to the range something like this:
dim myvar as variant
myvar = activecell.formulaR1C1
MyRange = range(myvar)
-
I keep getting an error "Object variable or With block variable not set". Should I be more flexible with my variable definitions?
Sub Test()
Dim myRange As Range
Dim urRange As Range
Range("A2").Select
myRange.FormulaR1C1 = ActiveCell.FormulaR1C1
urRange = Range("myrange")
End Sub
LauRa
-
Thanks for the help. I finally got it to work. Here's the code in case anyone's interested:
MFCount & SFCount are Integers set earlier in the code
If SFUPC = MFUPC Then
Windows("Final_Multi_Family.xls").Activate
tempRange = "I" & MFCount
Range(tempRange).Activate
Desc = ActiveCell.Offset(0, 1).Text
Windows("Final_SingleFamily.xls").Activate
tempRange = "J" & SFCount
Range(tempRange).Activate
ActiveCell.Value = Desc
ElseIf SFUPC < MFUPC Then
Else
End If