Range with variables

Imh0tep

New Member
Joined
Feb 7, 2019
Messages
14
Hi all,

I have variable alfa, which contains number of last non-empty cell from column A from Sheet2. Following code works fine.

Code:
[COLOR=#000000][FONT=monospace]Worksheets("Sheet1").Range([/FONT][/COLOR][COLOR=#0000cd][FONT=monospace]"B30:B" & alfa + 28[/FONT][/COLOR][COLOR=#000000][FONT=monospace]).Value = Worksheets("Sheet2").Range("A2:A" & alfa).Value[/FONT][/COLOR]

I would like to have next variable (called beta) also in first argument. I tried to do it analogical but without succes.

I tried "B" & beta +1 : "B" & alfa +28 and "B" & beta+1 & ":" & "B" & alfa + 28 instead of "B30:B" & alfa + 28 but it doesn't work too.


Variable beta contains number of row which contains some special symbol (^).


Do you have any idea how to solve it?

Thank you very much


 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Try
Code:
   Sheets("sheet1").Range("B" & Beta + 1 & ":B" & Alpha + Beta - 1).Value = Sheets("Sheet2").Range("A2:A" & Alpha).Value
 
Upvote 0

Forum statistics

Threads
1,223,244
Messages
6,170,976
Members
452,372
Latest member
Natalie18

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