1

I'm doing my first Excel VBA project and am having some trouble. I'd like to get the value in a cell in the CurrentBalance column. I'll be using ActiveCell.Row to get the row number. And I'd like to use a named range for the column in case I need to insert additional columns later.

So what I'd like to have is: BalanceVariable = "CurrentBalance"$ActiveCell.Row

I've been trying things for an hour and can't get it to work. I've tried Range and Cell and othe things. Suggestions?

0

1 Answer 1

4

CurrentBalance is a named range.

Sub test()
Dim BalanceVariable As Double
BalanceVariable = Cells(ActiveCell.Row, Range("CurrentBalance").Column)
MsgBox "the current balance is " & BalanceVariable

End Sub

enter image description here

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

Comments

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.