move around cells

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Folks

All I want to do is:
select a cell
activate cell
Go to start of cell
Highlight first five characters
Cut these characters
Move left to adjacent cell
paste characters to cell
Move down
Move right

I'm quite happy to use a keyboard control to activate the
macro each time I need it.

I can do this in recorder but the cell ranges are hard
coded. I need it to be local to the cell I am in. All
help much appreciated.

Joe
 
Joe,

try this:

Sub MoveAround()

Dim CellVal As String

CellVal = ActiveCell.Text
Range(ActiveCell.Address) = Right(CellVal, Len(CellVal) - 5)
ActiveCell.Offset(0, 1).Select
Range(ActiveCell.Address) = Left(CellVal, 5)

End Sub
 
Joe,

forgot the "Move down - Move right" part:

ActiveCell.Offset(1, 1).Select
 
Hi Fred

You're a champ. Thanks for the help.
-----Original Message-----
Joe,

forgot the "Move down - Move right" part:

ActiveCell.Offset(1, 1).Select






.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top