Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
teamwill
 
Posts: n/a
Default Macro that looks at cell contents


I have a column filled with ID numbers. Some begin with E. example
E12353. Other ID numbers are 5 digits long. example 12345. Every day I
copy and paste these numbers from a program and into my excel
spreadsheet. Along with these numbers is important data that I also
copy and paste into the spreadsheet. On the other side of the company
they use the same ID's but add "00" to the end of all 5 digit ID
numbers. It is not important to either side that these numbers dont
match so they dont care. I have to deal with combining these ID's to
get good information multiple times a day and very quickly at that. I
have set up a Vlookup table and everything else that I need to come up
with a total immediately. Right now I manually go through all the ID
numbers and add two 0's at the end of the ID's. I know how to create
basic macros but I couldn't find anything on how to do this. I paste
these ID numbers in col A. Simply put. I need a macro to find all 5
digit numbers in Col A and add two zeros to the end of them.

Please help and change my days for the better.
Thanks, Will


--
teamwill
------------------------------------------------------------------------
teamwill's Profile: http://www.excelforum.com/member.php...o&userid=30256
View this thread: http://www.excelforum.com/showthread...hreadid=499252

  #2   Report Post  
Posted to microsoft.public.excel.misc
ShaunM
 
Posts: n/a
Default Macro that looks at cell contents


Hi Will

Here is a simple vba macro that will do what you need, It assumes that
your list of ID's does not contain any blank cells.

To use it you will need to go to the vba editor and create a module
then paste the following:
'--------------------------------------
Sub AddZeros()
Dim count As Integer
Dim pos As String

count = 1
pos = "A" & count

While (Range(pos).Value < "")
If (Len(Range(pos).Value) = 5) Then
Range(pos).Value = Range(pos).Value & "00"
End If
count = count + 1
pos = "A" & count
Wend


End Sub
'------------------------------------------

In your worksheet I would suggest creating a button and attaching the
macro that so it can be run whenever you add new sets of ID's

Good Luck

Shaun


--
ShaunM
------------------------------------------------------------------------
ShaunM's Profile: http://www.excelforum.com/member.php...o&userid=18610
View this thread: http://www.excelforum.com/showthread...hreadid=499252

  #3   Report Post  
Posted to microsoft.public.excel.misc
teamwill
 
Posts: n/a
Default Macro that looks at cell contents


It works great and I learned something new.
thanks
Will


--
teamwill
------------------------------------------------------------------------
teamwill's Profile: http://www.excelforum.com/member.php...o&userid=30256
View this thread: http://www.excelforum.com/showthread...hreadid=499252

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
VBA Excel Macro to delete contents in named cell reaa Excel Discussion (Misc queries) 1 January 3rd 06 08:16 PM
Getting contents of a cell when cell reference is in the sheet A Nelson Excel Discussion (Misc queries) 3 October 5th 05 06:46 PM
Edit macro to match entire cell contents nis75p06 Excel Discussion (Misc queries) 1 September 3rd 05 04:27 PM
Macro to remove contents of cell and move all other contents up one row adw223 Excel Discussion (Misc queries) 1 July 1st 05 03:57 PM
Function syntax to compare cell contents ES Excel Worksheet Functions 2 May 18th 05 03:53 PM


All times are GMT +1. The time now is 04:53 PM.

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"