Forum

How to assign a var...
 
Notifications
Clear all

How to assign a variable value in to another variable

2 Posts
2 Users
0 Reactions
224 Views
(@chakkrav)
Posts: 3
Active Member
Topic starter
 

Hi All, how do i get the variable c address in my variable rng

dim r as range, c as string
c = Activecell.Entirecolumn.Address (False,False)
rng = Intersect(Range("C"),Activesheet.usedrange

It is throwing an error for variable rng 

 
Posted : 21/10/2018 9:20 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Ravikiran

Not quite sure what you mean but there are a few things you need to change

You've declared r as as range but you are using rng

You also need to Set a range variable

And are you trying to get the intersection of the range described by c and ActiveSheet.UsedRange?

Try this

 
Sub MyRanges()

Dim rng As Range, c As String

c = ActiveCell.EntireColumn.Address(False, False)

Set rng = Intersect(Range(c), ActiveSheet.UsedRange)

End Sub

 

Regards

Phil

 
Posted : 22/10/2018 12:26 am
Share: