Range string with cell address based on VBA

ChristineJ

Well-known Member
Joined
May 18, 2009
Messages
762
Office Version
  1. 365
Platform
  1. Windows
Two random numbers, y and z, are generated in my VBA as follows:

Randomize
y = Application.RandBetween(1, 8)

Randomize
z = Application.RandBetween(1, 8)

I want cell F18 to show a sentence with a cell address in it that adds 69 to y and 6 to z. I know what I have below is incorrect, but can it be adapted to VBA? Thanks.

Range("F18").Value = "Enter your answer in cell "&ADDRESS(69 + y, 6 + z, 4)
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
How about
VBA Code:
Range("F18").Value = "Enter your answer in cell " & Cells(69 + y, 6 + Z).Address
 
Upvote 0
How about
VBA Code:
Range("F18").Value = "Enter your answer in cell " & Cells(69 + y, 6 + Z).Address
Almost perfect! Is it possible to return the address in the string without the dollar signs: $H$80 would be H80, for example?
 
Upvote 0
Yup, use
VBA Code:
Cells(69 + y, 6 + Z).Address(0,0)
 
Upvote 0
Solution
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,216,095
Messages
6,128,800
Members
449,468
Latest member
AGreen17

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