Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default creating a macro to add text to existing data already in cell



Forgive me, I am new at Excel macros. I have a spreadsheet with
thousands of cells that now require extra text be added to the existing
data already in the cell. The extra text is the same for all cells
involved. I tried creating my own macro using record, doing the steps,
and stop recording but it applies the action to the original cells
rather than any new cells. I want to add "<brSteel (Zinc Plated)" to
each cell.

Here is what I have so far:
ActiveCell.FormulaR1C1 = "<brSteel (Zinc Plated)"

Thanks for the help!

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default creating a macro to add text to existing data already in cell

Hi Tim

take this sub and change it for your purpose:

Sub abb_bla()

Dim cell As Range

For Each cell In UsedRange
cell.Value = cell.Value & "<brSteel (Zinc Plated)"
Next cell

End Sub

hope that helps

Carlo


On Jan 29, 10:51*am, Tim New wrote:
Forgive me, I am new at Excel macros. *I have a spreadsheet with
thousands of cells that now require extra text be added to the existing
data already in the cell. *The extra text is the same for all cells
involved. *I tried creating my own macro using record, doing the steps,
and stop recording but it applies the action to the original cells
rather than any new cells. *I want to add "<brSteel (Zinc Plated)" to
each cell.

Here is what I have so far:
ActiveCell.FormulaR1C1 = "<brSteel (Zinc Plated)"

Thanks for the help!

*** Sent via Developersdexhttp://www.developersdex.com***


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default creating a macro to add text to existing data already in cell


Carlo,
When I run it, I get a error at Next cell saying: Next without For.
Here is what I now have:
Sub Macro8()
'
' Macro8 Macro
' Macro recorded 1/28/2008 by Timothy
'
' Keyboard Shortcut: Ctrl+e
'
ActiveCell.FormulaR1C1 = cell.Value & "<brSteel Fitting (Zinc
Plated)"
Next cell

End Sub





*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default creating a macro to add text to existing data already in cell

I change the macro to:
Sub Macro8()
'
' Macro8 Macro
' Macro recorded 1/28/2008 by Timothy
'
' Keyboard Shortcut: Ctrl+e
'
Dim cell As Range

For Each cell In UsedRange
cell.Value = cell.Value & "<brSteel (Zinc Plated)"
Next cell

End Sub

I now get runtime error 424 Object Required

*** Sent via Developersdex http://www.developersdex.com ***
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default creating a macro to add text to existing data already in cell

On Jan 29, 11:23*am, Tim New wrote:
Carlo,
When I run it, I get a error at Next cell saying: Next without For.
Here is what I now have:
Sub Macro8()
'
' Macro8 Macro
' Macro recorded 1/28/2008 by Timothy
'
' Keyboard Shortcut: Ctrl+e
'
* * ActiveCell.FormulaR1C1 = cell.Value & "<brSteel Fitting (Zinc
Plated)"
* * Next cell

End Sub

*** Sent via Developersdexhttp://www.developersdex.com***


Hey Tim

well you don't have a For, that's what it says. try this:


Sub Macro8()
dim cell as range

for each cell in selection
cell.FormulaR1C1 = cell.Value & "<brSteel Fitting (Zinc Plated)"
Next cell

End Sub

hope that helps
Carlo




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default creating a macro to add text to existing data already in cell

Carlo,
That worked! I dont care what everyone else says, you're the best. You
saved me tons of time and gave me a learning experience.
Thanks!
Timothy



*** Sent via Developersdex http://www.developersdex.com ***
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default creating a macro to add text to existing data already in cell

On Jan 29, 12:04*pm, Tim New wrote:
Carlo,
That worked! *I dont care what everyone else says, you're the best. *You
saved me tons of time and gave me a learning experience.
Thanks!
Timothy

*** Sent via Developersdexhttp://www.developersdex.com***


What exactly do you mean with: "what everyone else says"?

glad that it worked, thanks for your feedback

Carlo
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 a graph with existing data...clear data after save Cam Neeson Excel Programming 3 June 15th 06 06:37 PM
Creating a summary from existing spreadsheet data ... NP Excel Worksheet Functions 8 October 29th 04 02:39 PM
Creating a summary from existing spreadsheet data ... NP Excel Programming 8 October 29th 04 02:39 PM
VBA Creating a Macro to Move some of the text from one cell to another Lowell B. Copeland Excel Programming 4 August 28th 03 08:15 PM
VBA Creating a Macro to Move some of the text from one cell to another Ron de Bruin Excel Programming 0 August 28th 03 07:21 PM


All times are GMT +1. The time now is 11:41 PM.

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

About Us

"It's about Microsoft Excel"