Candidont

New Member
Joined
Mar 21, 2018
Messages
3
Something's not right and I expect the x and y won't change in the quotations. Any ideas?

Sub linkMergedCells()
Dim x As Integer
Dim n As Integer
n = 3
x = 6
Do While x > 0
For y = 1 To 6
Worksheets("Sheet1").Cells ("A" & n)
.Formula = "=Sheet3!(x,y)"
n = n + 2
Next y
x = x - 1
Loop
End Sub

Thanks
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Anything between double-quotes is literal text. x and y need to be outside of the quotes.
So you need to break it up into literal text and variables concatenate together.
But (x,y) is not a valid range reference anyway. Maybe this is what you mean?
Code:
[B]Worksheets("Sheet1").Cells(n, "A").Formula = "=Sheet3!" & Cells(x,y).Address[/B]
If that isn't it, you are going to need to explain exactly what it is that you are trying to do, so we are guessing based on errant code.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,061
Messages
6,122,921
Members
449,094
Latest member
teemeren

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