VBA get the cell value in a cell that is on the same row.

decadence

Well-known Member
Joined
Oct 9, 2015
Messages
525
Office Version
  1. 365
  2. 2016
  3. 2013
  4. 2010
  5. 2007
Platform
  1. Windows
Hi, Is it possible to copy or get the cell value from a set range of cells which is a variable to a static range of cells that will never change but on the same row.

I am using this for my range variable but Columns("AA:AA") will be the static range
Code:
        Set Rng = Rng.Resize(Cells(Rows.Count, Rng.Column).End(xlUp).Row)


Example 1:

Form this
A
B
1
2
3
Cell Value 1
4
Cell Value 2

<tbody>
</tbody>

To this
AA
1
2
3
Cell Value 1
4
Cell Value 2

<tbody>
</tbody>

Example 2:

From this
A
B
C
1
2
Cell Value 1
3
Cell Value 2
4
Cell Value 3

<tbody>
</tbody>

To this

AA
1
2
Cell Value 1
3
Cell Value 2
4
Cell Value 3

<tbody>
</tbody>
 
Last edited:

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
How about
Code:
Set rng = rng.Resize(Cells(Rows.Count, rng.Column).End(xlUp).Row)
rng.Copy Range("AA" & rng.Row)
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,822
Members
449,469
Latest member
Kingwi11y

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