Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default macro to edit cell contents

I need to edit a cell's contents by insert at ^ and the beginning and end of
what ever is in the cell, then move down to the next cell to be ready for the
next one.

Macro recorder can't seem to handle this.

Thanks.
--
Alan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default macro to edit cell contents

If I understand correctly, you'd like to insert a carat symbol at the
beginning and end of the contents of a cell (e.g., "harry" becomes "^harry^")
and then keep moving down the list of items and editing each one in the same
way until you run out of items. If that's what you want to do, then perhaps
this helps (you'll need to set focus on the first item in the list that you
want to edit and I'm assuming that you have no blanks in your list):

Sub EditCells()
Dim i As Integer
Do Until ActiveCell.Value = ""
ActiveCell.Value = "^" & ActiveCell.Value & "^"
ActiveCell.Offset(1, 0).Select
Loop
End Sub


"adgorn" wrote:

I need to edit a cell's contents by insert at ^ and the beginning and end of
what ever is in the cell, then move down to the next cell to be ready for the
next one.

Macro recorder can't seem to handle this.

Thanks.
--
Alan

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default macro to edit cell contents

here's one way, assuming your values start in a1 and are in 1 column

Sub test()
Dim lastrow As Long, cell As Range
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For Each cell In Range("A1:A" & lastrow)
cell.Value = "^" & cell.Value & "^"
Next
End Sub


--


Gary


"adgorn" wrote in message
...
I need to edit a cell's contents by insert at ^ and the beginning and end of
what ever is in the cell, then move down to the next cell to be ready for the
next one.

Macro recorder can't seem to handle this.

Thanks.
--
Alan



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default macro to edit cell contents

Sorry, you can delete the declaration of i (dim i as integer) in the code
below).

"Paul Mathews" wrote:

If I understand correctly, you'd like to insert a carat symbol at the
beginning and end of the contents of a cell (e.g., "harry" becomes "^harry^")
and then keep moving down the list of items and editing each one in the same
way until you run out of items. If that's what you want to do, then perhaps
this helps (you'll need to set focus on the first item in the list that you
want to edit and I'm assuming that you have no blanks in your list):

Sub EditCells()
Dim i As Integer
Do Until ActiveCell.Value = ""
ActiveCell.Value = "^" & ActiveCell.Value & "^"
ActiveCell.Offset(1, 0).Select
Loop
End Sub


"adgorn" wrote:

I need to edit a cell's contents by insert at ^ and the beginning and end of
what ever is in the cell, then move down to the next cell to be ready for the
next one.

Macro recorder can't seem to handle this.

Thanks.
--
Alan

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default macro to edit cell contents

Thanks everyone, worked great.
--
Alan


"Gary Keramidas" wrote:

here's one way, assuming your values start in a1 and are in 1 column

Sub test()
Dim lastrow As Long, cell As Range
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For Each cell In Range("A1:A" & lastrow)
cell.Value = "^" & cell.Value & "^"
Next
End Sub


--


Gary


"adgorn" wrote in message
...
I need to edit a cell's contents by insert at ^ and the beginning and end of
what ever is in the cell, then move down to the next cell to be ready for the
next one.

Macro recorder can't seem to handle this.

Thanks.
--
Alan




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
creating macro to edit cell contents mar10 Excel Programming 1 August 4th 06 02:51 AM
edit the contents of a cell using a macro stinson Excel Programming 1 November 29th 05 07:20 PM
Edit macro to match entire cell contents nis75p06 Excel Discussion (Misc queries) 1 September 3rd 05 04:27 PM
How can I edit cell contents with a macro in Excel? Mind the gaps! Excel Discussion (Misc queries) 2 March 23rd 05 08:51 PM
How can I edit cell contents with a macro in Excel? NotAnExpert Excel Discussion (Misc queries) 1 March 23rd 05 01:17 AM


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