Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am trying to figure out an easy way to create an excel macro that will take a substring and replace the string with that substring. Ex: 47130-5240 (original) take the first 5 characters and replace the original value with only those first 5 characters. So the result would be 47130 in that cell. Any ideas??? Thanks, Andrew *** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
activeCell.Value = Left(activeCell.Value,5)
-- Regards, Tom Ogilvy "Andrew Slentz" wrote in message ... Hi, I am trying to figure out an easy way to create an excel macro that will take a substring and replace the string with that substring. Ex: 47130-5240 (original) take the first 5 characters and replace the original value with only those first 5 characters. So the result would be 47130 in that cell. Any ideas??? Thanks, Andrew *** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hmm... Thanks a bunch. This makes sense but how do I apply that to a
specific column of an entire spreadsheet??? I am so lost... Thanks, Andrew *** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
try something like sub foo() dim rng as range dim cell as range application.screenupdating=false set rng = activesheet.range("A1:A100") for each cell in rng if len(cell.value)=5 then cell.value =left(cell.value,5) end if next application.screenupdating=true end sub -- Regards Frank Kabel Frankfurt, Germany Andrew Slentz wrote: Hmm... Thanks a bunch. This makes sense but how do I apply that to a specific column of an entire spreadsheet??? I am so lost... Thanks, Andrew *** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Edit REplace String | Excel Worksheet Functions | |||
search a string as substring and give adjacent values | Excel Worksheet Functions | |||
How do I replace last numeric string from a alphanumeric string? | Excel Discussion (Misc queries) | |||
How to get rid of string which contain a substring like 'PO BOX'. | Excel Programming | |||
replace a number with a string from database | Excel Programming |