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 VBA Creating a Macro to Move some of the text from one cell to another

Hello,

Example: The purpose is to use a macro to separate the two
letters of the state from a text string in a cell that
contains the city and the state, like "Boston MA".

Cell A1 Contains "Boston MA"

I want to be able to move ' MA' to cell B1 using a macro

The key strokes I am currently using are as follows:

Select cell A1 "Boston MA"
[F2] Edit

[Shift]+[Left Arrow][LeftArrow][LeftArrow] to select ' MA'
and the space character to the left of 'MA'

[Ctrl-X] to Cut ' MA'

[TAB] to move to cell B1

[Ctrl-V] to Paste ' MA' in cell B1

[Enter] to go to the next row in cell A2

When I create a macro of the above key strokes it takes
the value of the object cell A1 and pastes it into the A2
cell after I hit Enter.

It seems as though the programming is unable to read the
limited cut and paste command. It seems as though
the "Cell" is the smallest object VBA can handle. Is that
correct?

Is there some way to write a command that truncates a
string in a cell by cutting the last three characters of
the string and moving them to a new cell immediately to
the right of the active cell.

Any answer will help.

Thanks

Lowell
 
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
macro to move to another cell Frappier New Users to Excel 8 November 11th 08 02:06 PM
macro to move cursor one cell right Kodak1993 New Users to Excel 3 September 23rd 08 02:00 AM
Macro to move one cell down tjb Excel Worksheet Functions 13 April 22nd 08 09:52 PM
Creating a macro to find and replace text Louise Excel Worksheet Functions 10 June 8th 05 10:29 AM
Macro to move to next cell Neil[_12_] Excel Programming 2 August 2nd 03 09:45 PM


All times are GMT +1. The time now is 12:50 AM.

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"