Quick help needed: variable within a variable...

bapcki1

New Member
Joined
Nov 12, 2011
Messages
39
Hi Guys!

I would like to declare a variable that uses a value from another variable. (is this known as dynamic variables?)

The offending line is:

Code:
Wbq = ThisWorkbook.Sheets("Sheet 1").Cells(NumEntry, 2).Value

where NumEntry is the variable within another variable, Wbq.

It looks like this in the whole code text:

Code:
Sub Collation()

ThisWorkbook.Sheets("Collation").Range("B2:F12").ClearContents

Dim DiffcalcWb As Integer
Dim Wborig As Integer
Dim Wbq As Integer

NumEntry = ThisWorkbook.Sheets("Collation").Range("L2").Value
Wborig = ThisWorkbook.Sheets("Sheet 1").Range("B2").Value
Wbq = ThisWorkbook.Sheets("Sheet 1").Cells(NumEntry, 2).Value
DiffcalcWb = Wborig - Wbq
Sheets("Collation").Select
Range("B2").Value = DiffcalcWb

Can anyone help me please?


Paddy
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,223,113
Messages
6,170,174
Members
452,307
Latest member
Vorkosigan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top