Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Removing semicolons

This macros just received works but does not seem to stop
the looping until it returs the error "MS Visual Basic
400".
I would appreciate a bit of tweaking.

i = 1
Do
Target = Range("D" & i)
TargetLength = Len(Target)
CharLeft = Left(Target, 1)
CharRight = Right(Target, 1)

If CharLeft = ";" Then Target = Right(Target, Len
(Target) - 1)
If CharRight = ";" Then Target = Left(Target, Len
(Target) - 1)

Range("D" & i) = Target
i = i + 1
Loop

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Removing semicolons

JA,

Add
If IsEmpty(Range("D" & i)) = True Then Exit Do
after the
i=i+1
This checks for empty cells. There are quite a few of different
Is.....functions that may suit you better
depending upon your cell contents.
Do you need to check across your columns and change the D to an E
etc....

Donna

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
removing na Steve Excel Discussion (Misc queries) 3 January 26th 10 09:19 PM
Removing text between hyphens and removing the hyphens sonofroy Excel Discussion (Misc queries) 8 January 20th 10 05:25 PM
Removing #N/A nibble New Users to Excel 4 July 26th 07 06:22 PM
Removing patterns without removing gridlines pennyb9 Excel Discussion (Misc queries) 1 July 11th 07 02:43 AM
Removing semicolons JA[_3_] Excel Programming 2 February 25th 05 09:19 AM


All times are GMT +1. The time now is 05:47 AM.

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

About Us

"It's about Microsoft Excel"