Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default Save cell location to a variable

I need to save my active cell location into a variable so later I can select
a range from a specific cell all the way to the saved one cell.

For example I have data from A1:B20.. row 20 will change each time.
Then I do as follows:
Range ("A1:B1").select
Range(Selection, Selection.End(xlDown)).Select

Then I move one cell to the right
ActiveCell.Offset(0, 1).Select
I need to save this location (Cx)


Next I want to copy data from C1:G1 all the way to last record on column A
Range("C1:G1").Select
Selection.Copy

Here the tricky part
Range("C2:Cx).select
Paste

Hope is not too much detail for a simple question.
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Save cell location to a variable

Hello

you could declare a range variable

Dim Mycell as range

and replace
I need to save this location (Cx)

with
Set MyCell = ActiveCell


Then replace
Range("C2:Cx).select
with
Range("C2",MyCell).select



"Alberto Ast" a écrit dans le message
de ...
I need to save my active cell location into a variable so later I can
select
a range from a specific cell all the way to the saved one cell.

For example I have data from A1:B20.. row 20 will change each time.
Then I do as follows:
Range ("A1:B1").select
Range(Selection, Selection.End(xlDown)).Select

Then I move one cell to the right
ActiveCell.Offset(0, 1).Select
I need to save this location (Cx)


Next I want to copy data from C1:G1 all the way to last record on column A
Range("C1:G1").Select
Selection.Copy

Here the tricky part
Range("C2:Cx).select
Paste

Hope is not too much detail for a simple question.
Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default Save cell location to a variable

This was great... thanks...

"Charabeuh" wrote:

Hello

you could declare a range variable

Dim Mycell as range

and replace
I need to save this location (Cx)

with
Set MyCell = ActiveCell


Then replace
Range("C2:Cx).select
with
Range("C2",MyCell).select



"Alberto Ast" a écrit dans le message
de ...
I need to save my active cell location into a variable so later I can
select
a range from a specific cell all the way to the saved one cell.

For example I have data from A1:B20.. row 20 will change each time.
Then I do as follows:
Range ("A1:B1").select
Range(Selection, Selection.End(xlDown)).Select

Then I move one cell to the right
ActiveCell.Offset(0, 1).Select
I need to save this location (Cx)


Next I want to copy data from C1:G1 all the way to last record on column A
Range("C1:G1").Select
Selection.Copy

Here the tricky part
Range("C2:Cx).select
Paste

Hope is not too much detail for a simple question.
Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Save cell location to a variable

Thanks for the result

CA

"Alberto Ast" a écrit dans le message
de ...
This was great... thanks...

"Charabeuh" wrote:

Hello

you could declare a range variable

Dim Mycell as range

and replace
I need to save this location (Cx)

with
Set MyCell = ActiveCell


Then replace
Range("C2:Cx).select
with
Range("C2",MyCell).select



"Alberto Ast" a écrit dans le
message
de ...
I need to save my active cell location into a variable so later I can
select
a range from a specific cell all the way to the saved one cell.

For example I have data from A1:B20.. row 20 will change each time.
Then I do as follows:
Range ("A1:B1").select
Range(Selection, Selection.End(xlDown)).Select

Then I move one cell to the right
ActiveCell.Offset(0, 1).Select
I need to save this location (Cx)

Next I want to copy data from C1:G1 all the way to last record on
column A
Range("C1:G1").Select
Selection.Copy

Here the tricky part
Range("C2:Cx).select
Paste

Hope is not too much detail for a simple question.
Thanks




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rolling sum cell variable location input ADP Excel Programming 1 October 12th 08 01:44 PM
how to set up a simple variable in Excel, but cell location independent Alberta K. Excel Worksheet Functions 3 December 19th 07 03:55 PM
Way to store cell location to variable? farful[_3_] Excel Programming 2 July 12th 06 11:44 PM
VBA - Passing Cell Location To Variable ajocius[_35_] Excel Programming 2 October 4th 05 01:55 PM
using variable as cell location Brad[_14_] Excel Programming 5 January 5th 04 07:17 PM


All times are GMT +1. The time now is 04:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"