LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using FormulaR1C1 to find fields begining with spaces


Good Day

I'm writing a Macro that must find all fields that start with a space
and move them to another column depending on the number of spaces.

Eg.from this

Code:
--------------------

Carrots 6
Onions 7
Veggies 13
Bananas 5
Oranges 9
Apples 2
Fruits 16
Fridge 29

--------------------


To this:

Code:
--------------------

Carrots 6 Veggies 13 Fridge 29
Onions 7 Veggies 13 Fridge 29
Bananas 5 Fruits 16 Fridge 29
Oranges 9 Fruits 16 Fridge 29
Apples 2 Fruits 16 Fridge 29

--------------------


I'm thinking of something like this in terms of code:


Code:
--------------------

Sheets("Sheet1").Select

' Start moving fields
ActiveWorkbook.Names.Add Name:="Start", RefersTo:=Range("A6")
Range("Start").Select

Do
If ActiveCell.FormulaR1C1 = " " & (Whatever is contained in the field) Then
Range(ActiveCell, ActiveCell.End(xlToRight)).Select
Selection.Cut
End If


ActiveCell.Offset(1, 0).Activate

Loop Until ActiveCell.Value = ""

--------------------


Thanks for your help:


--
poppy
------------------------------------------------------------------------
poppy's Profile: http://www.excelforum.com/member.php...o&userid=11453
View this thread: http://www.excelforum.com/showthread...hreadid=558331

 
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
How can I remove blank spaces from fields nozzaworld Excel Discussion (Misc queries) 6 February 22nd 10 02:34 PM
Find & Replace (Adding two characters at begining) Ty Archer Excel Discussion (Misc queries) 5 July 29th 09 04:36 PM
How do I autofill spaces in right justified fields? Bob_Balch Excel Discussion (Misc queries) 1 July 18th 08 04:42 AM
Custom Fields with spaces [email protected] Excel Discussion (Misc queries) 15 July 16th 07 10:09 AM
Add spaces for specific fields to paste in Corey Excel Discussion (Misc queries) 3 December 30th 05 10:22 PM


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