Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Mind the gaps!
 
Posts: n/a
Default How can I edit cell contents with a macro in Excel?

I'm trying to creat an Excel macro that edits cell data, remembering the
edits, not just the resulting value or formula. If, for example, I want to
delete all but the last three characters of a cell value, and I record a
macro, editing the cell produces a line like: ActiveCell.FormulaR1C1 = "745".
But I don't want the specific value. I want the process.

I'm essentially asking for RIGHT(R1C1,3), but I can't use that formula in
the macro because it would be a circular reference. What am I missing?
  #2   Report Post  
Rowan
 
Posts: n/a
Default

If you use the Value property you can just replace the old value with the new
one e.g.

ActiveCell.Value = Right(ActiveCell.Value, 3)

Regards
Rowan

"Mind the gaps!" wrote:

I'm trying to creat an Excel macro that edits cell data, remembering the
edits, not just the resulting value or formula. If, for example, I want to
delete all but the last three characters of a cell value, and I record a
macro, editing the cell produces a line like: ActiveCell.FormulaR1C1 = "745".
But I don't want the specific value. I want the process.

I'm essentially asking for RIGHT(R1C1,3), but I can't use that formula in
the macro because it would be a circular reference. What am I missing?

  #3   Report Post  
NotAnExpert
 
Posts: n/a
Default

I knew this had to be easy. That's why I could never find it in the books.
Rowan, Thank you very much!

NotAnExpert, aka MindTheGaps!

"Rowan" wrote:

If you use the Value property you can just replace the old value with the new
one e.g.

ActiveCell.Value = Right(ActiveCell.Value, 3)

Regards
Rowan

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
Scan and edit document in excel 2003. johmoc Excel Discussion (Misc queries) 0 March 18th 05 04:53 PM
lose formatting (border) in excel cell after pasting from word Reverse_Solidus Excel Discussion (Misc queries) 2 March 16th 05 10:01 PM
I have typed in an excel cell and cannot advance to next cell by . aneruth Excel Discussion (Misc queries) 1 January 14th 05 02:34 AM
How to switch to edit the cell hon123456 Excel Discussion (Misc queries) 2 January 13th 05 10:40 AM
Excel: how to formulate conditional cell references centraloffice Excel Worksheet Functions 1 December 10th 04 08:57 PM


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