Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default I need help, sorting and changing

I have a file with location numbers, the company i work for has a differetn
location number than those.

here is the request, I need to take the original number and have it change
to our number, does this make sense.?




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default I need help, sorting and changing

I tried the array, but it has a problem it guives some crazy numbers, not
the correct store #'s, this is basically find and replace, like the guy was
saying but it needs to be programatically,

Does the array need to be in numerical order (1,2,3,4...)?

can it hold more than 100 items?

should i put it in a command button?

"Guillermo" wrote in message
.. .
I have a file with location numbers, the company i work for has a differetn
location number than those.

here is the request, I need to take the original number and have it change
to our number, does this make sense.?






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default I need help, sorting and changing

yes but there are 100 independet values
"Paul Martin" wrote in message
ups.com...
Guillermo

This sounds like a simple find and replace, assuming that you can map
one number to another.

Regards

Paul Martin
Melbourne, Australia



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default I need help, sorting and changing

sorry, I tried it but it did not work, it returns some weird numbers like it
tries to replace every time number it finds

like 2222

it replaces with 234434 234434 234434 etc..

som eone toldme to to use anf if statement and then vlook up any ideas?
"Toppers" wrote in message
...
Hi,
This replaces old values with new, assuming data to be changed is
in column A. Change column as required.

Sub ReplaceLocations()

Dim i As Long, OldLocation As Variant, NewLocation As Variant

OldLocation = Array(1234, 6789, 5643) ' Old Location Numbers
NewLocation = Array(5321, 9065, 7112) ' New Location Numbers

For i = LBound(OldLocation) To UBound(OldLocation)
Columns("A:A").Replace What:=OldLocation(i),
Replacement:=NewLocation(i)
Next i

End Sub


HTH

"Guillermo" wrote:

I have a file with location numbers, the company i work for has a
differetn
location number than those.

here is the request, I need to take the original number and have it
change
to our number, does this make sense.?







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default I need help, sorting and changing

Hi,
Here is a VLOOKUP version. It assumes the original locations are in
column A and a table of Old/New locations in colums M and N - M contains the
old and N the corresponding new. Change thse ranges as required.

Sub LookupLocations()

Dim i As Long, iLastrow As Long, rngA As Range, cell As Range, res As Variant
Dim LookUptbl As Range

iLastrow = Cells(Rows.Count, "A").End(xlUp).Row
' Changes these as required
Set rngA = Range("a2:a" & iLastrow) ' Source Locations
Set LookUptbl = Range("M1:N200") ' contains Old/New locations

For Each cell In rngA
res = Application.VLookup(cell.Value, LookUptbl, 2, False)
If Not IsError(res) Then
cell.Value = res ' replace old with new
Else
MsgBox cell.Value & " not found in lookup table"
End If
Next cell

End Sub

"Guillermo" wrote:

sorry, I tried it but it did not work, it returns some weird numbers like it
tries to replace every time number it finds

like 2222

it replaces with 234434 234434 234434 etc..

som eone toldme to to use anf if statement and then vlook up any ideas?
"Toppers" wrote in message
...
Hi,
This replaces old values with new, assuming data to be changed is
in column A. Change column as required.

Sub ReplaceLocations()

Dim i As Long, OldLocation As Variant, NewLocation As Variant

OldLocation = Array(1234, 6789, 5643) ' Old Location Numbers
NewLocation = Array(5321, 9065, 7112) ' New Location Numbers

For i = LBound(OldLocation) To UBound(OldLocation)
Columns("A:A").Replace What:=OldLocation(i),
Replacement:=NewLocation(i)
Next i

End Sub


HTH

"Guillermo" wrote:

I have a file with location numbers, the company i work for has a
differetn
location number than those.

here is the request, I need to take the original number and have it
change
to our number, does this make sense.?








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
formulas changing when sorting harleyq Excel Discussion (Misc queries) 1 August 2nd 07 10:58 AM
Changing the sorting order... Conrad C. Excel Worksheet Functions 4 April 18th 07 06:54 PM
sorting without changing formats LisaD Excel Worksheet Functions 4 April 4th 07 10:59 PM
sorting a constantly changing set of rows in VBA ayl322 Excel Discussion (Misc queries) 4 September 16th 05 03:04 PM
Sorting changing a table searching Syrus the Virus[_6_] Excel Programming 1 January 14th 04 03:35 PM


All times are GMT +1. The time now is 03:02 PM.

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"