Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Stripping The First Four Characters from a value

Hi,
What I am trying to figure out is how I can remove the first four characters
via a VBA Macro from a value of a cell.

Here's the example...

Edition = ActiveCell.FormulaR1C1 (this returns a value of "Rev XA" or "Rev
-" or "Rev 2")

What I want the macro to do is strip the "Rev " and just keep everything
from the fifth character on so I get (XA or - or 2)

Any Ideas??

Thanks In Advance,
Rob
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 733
Default Stripping The First Four Characters from a value

Rob wrote...
What I am trying to figure out is how I can remove the first four characters
via a VBA Macro from a value of a cell.

....

Try

somecell.Value = Mid(somecell.Value, 5)

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Stripping The First Four Characters from a value

similar to the technique used in the worksheet:

edition = Right(edition, Len(edition) - 4)
--
Gary''s Student
gsnu200702


"Rob" wrote:

Hi,
What I am trying to figure out is how I can remove the first four characters
via a VBA Macro from a value of a cell.

Here's the example...

Edition = ActiveCell.FormulaR1C1 (this returns a value of "Rev XA" or "Rev
-" or "Rev 2")

What I want the macro to do is strip the "Rev " and just keep everything
from the fifth character on so I get (XA or - or 2)

Any Ideas??

Thanks In Advance,
Rob

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Stripping The First Four Characters from a value

If all your data to fix is in the same column, you could record a macro when you
select that range.

Then Data|Text to columns
Fixed width
draw a line between the 4th and 5th character (and no other lines)
and skip (do not import) that first field.

With lots of data, I would bet that this would be faster than looping through
the range.

Rob wrote:

Hi,
What I am trying to figure out is how I can remove the first four characters
via a VBA Macro from a value of a cell.

Here's the example...

Edition = ActiveCell.FormulaR1C1 (this returns a value of "Rev XA" or "Rev
-" or "Rev 2")

What I want the macro to do is strip the "Rev " and just keep everything
from the fifth character on so I get (XA or - or 2)

Any Ideas??

Thanks In Advance,
Rob


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Stripping The First Four Characters from a value

THANK YOU SOOO VERY MUCH!!! That was the perfect solution that I was looking
for!

Thanks Again,
Cheers!
Rob

"Gary''s Student" wrote:

similar to the technique used in the worksheet:

edition = Right(edition, Len(edition) - 4)
--
Gary''s Student
gsnu200702


"Rob" wrote:

Hi,
What I am trying to figure out is how I can remove the first four characters
via a VBA Macro from a value of a cell.

Here's the example...

Edition = ActiveCell.FormulaR1C1 (this returns a value of "Rev XA" or "Rev
-" or "Rev 2")

What I want the macro to do is strip the "Rev " and just keep everything
from the fifth character on so I get (XA or - or 2)

Any Ideas??

Thanks In Advance,
Rob

Reply
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
Named Ranges - what characters are (or are not) allowed in the nam Niek Otten Excel Discussion (Misc queries) 0 August 4th 06 01:28 PM
How can I control the length of characters a code will return? Tayo Excel Discussion (Misc queries) 0 April 7th 06 04:22 PM
Formula to replace invalid filename characters tschultz Excel Worksheet Functions 2 January 27th 06 07:07 PM
Remove varying amounts of space characters Access Joe Excel Discussion (Misc queries) 4 January 13th 06 10:28 PM
Help - Can't directly input Japanese characters into cell NKK Excel Discussion (Misc queries) 0 January 3rd 06 02:00 AM


All times are GMT +1. The time now is 09:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"