![]() |
VB Macro
It used to be that you could record a macro and it would replicate the
actions you did while recording i.e. open cell, backspace four times, return - and the result would be that you would eliminate the last four charecters in each of the cells where you ran the macro. This does not seem to be the case any longer since Excel now uses VB. I would appreciate advice on the entries to make in VB to accomplish eliminating the last four charecters of a cells contents. Many Thanks! |
VB Macro
One way,
Sub RemoveLastFour() n = ActiveCell.Value r = Len(ActiveCell) - 4 ActiveCell = Left(n, r) End Sub Regards, Paul "Matt" wrote in message ... It used to be that you could record a macro and it would replicate the actions you did while recording i.e. open cell, backspace four times, return - and the result would be that you would eliminate the last four charecters in each of the cells where you ran the macro. This does not seem to be the case any longer since Excel now uses VB. I would appreciate advice on the entries to make in VB to accomplish eliminating the last four charecters of a cells contents. Many Thanks! |
VB Macro
Or, for a selected range:
Sub RemoveLastFourFromAll() Dim cl as Range 'Stop screen flashing Application.Screenupdating = False 'Remove last 4 characters For Each cl in Selection cl.value = Left(cl.value,Len(cl.value)-4)) Next cl Application.Screenupdating = True End Sub This will work on all cells within the selected area -- Ken Puls www.officearticles.com "PCLIVE" wrote in message ... One way, Sub RemoveLastFour() n = ActiveCell.Value r = Len(ActiveCell) - 4 ActiveCell = Left(n, r) End Sub Regards, Paul "Matt" wrote in message ... It used to be that you could record a macro and it would replicate the actions you did while recording i.e. open cell, backspace four times, return - and the result would be that you would eliminate the last four charecters in each of the cells where you ran the macro. This does not seem to be the case any longer since Excel now uses VB. I would appreciate advice on the entries to make in VB to accomplish eliminating the last four charecters of a cells contents. Many Thanks! |
All times are GMT +1. The time now is 07:44 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com