Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / September 2007

Tip: Looking for answers? Try searching our database.

Restricting more than x number of characters in a cell....

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
J.W. Aldridge - 29 Sep 2007 14:06 GMT
I have a macro that refreshes a web query. The data that it pulls
changes format quite often.
Is there any way to limit the number of characters pulled or shown in
a cell/column?

Example:
(In one column)
ABCDEFG
ABCDEFG
ABCDEFG
ABCDEFG
ABCDEFG
ABCDEFG

I only want the first four characters (without running a Left formula
in another column) in the column.

Example:
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
Gary''s Student - 29 Sep 2007 21:32 GMT
Let's assume that you already have a routine the does the web refresh:
Sub Offer_Refreshments
Let's assume that the data refreshed goes in column A.  Include a new routine:

Sub limitum()
Set rr = Intersect(ActiveSheet.UsedRange, Range("A:A"))
For Each r In rr
   r.Value = Left(r.Value, 4)
Next
End Sub

Now your main routine would have code like:
Call Offer_Refreshments
Call limitum
Signature

Gary''s Student - gsnu2007

> I have a macro that refreshes a web query. The data that it pulls
> changes format quite often.
[quoted text clipped - 20 lines]
> ABCD
> ABCD

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.