![]() |
Simple macro help
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 |
Simple macro help
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 -- Regards Frank Kabel Frankfurt, Germany Joe wrote: 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 |
All times are GMT +1. The time now is 02:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com