finalcolumn?

xtscars

New Member
Joined
Apr 11, 2011
Messages
17
I'm trying to paste something in the final column +1. right now I have: finalcolumn=Range("XFD1").End(xlToLeft).Column

so if I understand it, I have just defined what "finalcolumn" means, right? So now that it's defined, how do I actually use it? Range("finalcolumn")? Super confused. Thanks!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Welcome to the Board!

You have just stored the column reference number.
So you could use:
Cells(1,finalcolumn).Offset(0,1).Select
to select the first blank column after the last populated column in row 1.
(note the format is Cells(row, column) and Offset(row, column))
 
Upvote 0
Hi and welcome to the board!!!
There are several ways to do this depending on you need. The way you are doing this, you are getting the Column Number of the Final Column. So to get the cell in Row 1 for the next column, you can use
Code:
Cells(1,finalcolumn+1)
As I said, until we know more about your needs, we can only guess the best way

lenze
 
Upvote 0
you guys rock! I have recorded a macro but it's sloppy and with all the offsets, whenever there is a change, it's thrown off, so I'm trying to use variables. I'm new to all this, though, so I'm struggling. I'll be back with more questions. thanks for the help!
 
Upvote 0
what is the best way to copy and paste in relation to the final row or column? For example I want to copy the top row final column, and move one column over to the right, and paste it there. This is what I'm playing with, and failing:

Cells(1,finalcolumn).select
Range("").Copy destination: range (""+1)

Any thoughts?
 
Upvote 0
is there a neater way to do this?

cells(1,finalcolumn).select
selection.copy
cells(a,finalcolumn+1).select
selection.paste

I think that works, but there is a better way, right?
 
Upvote 0
it worked! I put "1" instead of "a" in your equation, and it worked. What I don't understand is where in your code it directs excel to paste it? All I see is a command to copy, how does it know to paste? Thanks!
 
Upvote 0
the destination is an 'argument' of the copy command

It should look like

Code:
cells(a,finalcolumn).copy destination:=cells(a,finalcolumn+1)
but since it's the first argument, it doesn't need to be specific.
 
Upvote 0
thank you! If you don't mind, would you help me figure this one out, too? I'm trying to copy the entire final column.

I'm trying something like this: range(1,finalcolumn:finalrow,finalcolumn).copy

but that's not flying.
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,181
Members
452,893
Latest member
denay

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