1

So I run into a problem where I Dim A as range, but when I set A = to cells(1,1) and Cell(1,1) happen to be fill in with a text let say "BB" then A = "BB" instead of range("A1"). Can someone explain to me wat going on.

I Haven't tried anything as I don't know where to start I have been trying to work around it but I cant anymore

2 Answers 2

1

A is a range - but the default property of Range is value.

Depending on how you output A - the value-property is used.

Sub test()
Dim A As Range
Set A = ActiveSheet.Cells(1, 1)      'cell content = BB

Debug.Print A.Address, A.Value, A

End Sub

Output in the immediate window:

$A$1 BB BB

Sign up to request clarification or add additional context in comments.

Comments

0

Then how do I set overwrite the A (range Variable) with a new range. As base of the explanation above if A = cells(1,1) and cells(1,1).value is BB, then u set A = cells(1,2) while cells(1,2).value is CC. That would not overwrite the the Value of cells(1,1) with the Value of cells(1,2) but wont change the store range variable of A?

1 Comment

Please do not relate to other awnsers by position. The possition of awnsers may change in the future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.