Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
John Grossman
 
Posts: n/a
Default Need simple little macro - edit add 3 spaces

How do I do F2 - home - add 3 spaces and enter.
Don't want it to carry over name I'm editing - each row different


  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

John,

With a formula, for a string in A1:

=" " & A1

Copy down to match your cells, then copy / pastespecial values and get rid of your original values.

With a macro, select the cells that you want to change, and run this macro

Sub Add3Spaces()
Dim myCell As Range
For Each myCell In Selection
myCell.Value = " " & myCell.Value
Next myCell
End Sub

HTH,
Bernie
MS Excel MVP


"John Grossman" wrote in message ...
How do I do F2 - home - add 3 spaces and enter.
Don't want it to carry over name I'm editing - each row different



  #3   Report Post  
Bob Phillips
 
Posts: n/a
Default

Activecell.Value = " " & Activecell.Value

--

HTH

RP
(remove nothere from the email address if mailing direct)


"John Grossman" wrote in message
...
How do I do F2 - home - add 3 spaces and enter.
Don't want it to carry over name I'm editing - each row different




  #4   Report Post  
Gary's Student
 
Posts: n/a
Default

Assuming you want to pre-pad selected cells with three spaces, try:

Sub padit()
Dim r As Range
Set r = Selection
r.Value = " " & r.Value
End Sub

--
Gary's Student


"John Grossman" wrote:

How do I do F2 - home - add 3 spaces and enter.
Don't want it to carry over name I'm editing - each row different



  #5   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Gary's Student,

That code should have given you an error when you tested it on a multi-cell selection.

HTH,
Bernie
MS Excel MVP


"Gary's Student" wrote in message
...
Assuming you want to pre-pad selected cells with three spaces, try:

Sub padit()
Dim r As Range
Set r = Selection
r.Value = " " & r.Value
End Sub

--
Gary's Student


"John Grossman" wrote:

How do I do F2 - home - add 3 spaces and enter.
Don't want it to carry over name I'm editing - each row different







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
Recording simple macro Dave Excel Worksheet Functions 5 July 16th 05 12:34 AM
Simple Hyperlink Macro Rebecca New Users to Excel 3 April 10th 05 08:21 AM
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
Can't get simple macro to run Abi Excel Worksheet Functions 5 January 12th 05 07:37 PM


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