Simple macro help

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

Guest

Hi Folks

I have the following macro that cuts the front 6 characters out of a cell and pastes that data in another cell. I have tried but can't modify it to cut the last 5 characters from a cell and paste them in another cell. I swear I'm missing something really easy here. All help much appreicated.

Sub MoveAround()

Dim CellVal As String

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

End Sub
 
Hi
try
sub move_it2()
dim rng as range
set rng = activecell
with rng
.offset(0,1).value=right(rng.value,5)
.value = left(.value,len(.value)-5)
end with
end sub
 

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