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

I have saved an activecell value to a variable

xlastdev = ActiveCell.Value

Then have saved an activecell adress to anotehr variable

xnextDev = ActiveCell.Address

I want to assign the last value to the next address

Range(xnextDev).Value = xlastdev

But it does not work... it fail at the last command.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default assign variable to a range

--It does work..Try the below code in Step Into mode (use F8 instead of F5)

--You are writing the stored value to the same cell

xlastdev = ActiveCell.Value
xnextDev = ActiveCell.Address

Range(xnextDev).ClearContents
Msgbox "Cleared"

Range(xnextDev).Value = xlastdev

--If you are looking to write to the next cell try
Range(xnextDev).OffSet(1) = xlastdev


If this post helps click Yes
---------------
Jacob Skaria


"Alberto Ast" wrote:

I have saved an activecell value to a variable

xlastdev = ActiveCell.Value

Then have saved an activecell adress to anotehr variable

xnextDev = ActiveCell.Address

I want to assign the last value to the next address

Range(xnextDev).Value = xlastdev

But it does not work... it fail at the last command.

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
Assign copied range to a variable johnmasvou Excel Programming 3 March 20th 09 10:44 AM
VBA Excel how to assign name in variable range Mouimet Excel Programming 4 November 14th 08 05:56 PM
range variable won't assign (chartobject.topleftcell property) Matthew Dodds Excel Programming 2 November 16th 05 02:25 PM
How to assign a variable in a range select Paul Excel Programming 5 June 3rd 05 11:50 PM
How can I assign a range starting cell based on a variable locati. feman007 Excel Discussion (Misc queries) 1 March 9th 05 11:41 PM


All times are GMT +1. The time now is 03:32 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"