Difference between revisions of "Vba/Match2tabels"

From s23
< Vba
Jump to navigation Jump to search
imported>DrOwl
(*match data in 2 diffrent sheets)
 
imported>mutante
m
 
Line 1: Line 1:
 
 
*<pre>Sub matchRouterNames_RoutersTab_RCLDump_MGTIP()
 
*<pre>Sub matchRouterNames_RoutersTab_RCLDump_MGTIP()
 
Worksheets("RCL.Dump").Select
 
Worksheets("RCL.Dump").Select
Line 25: Line 24:
  
 
sorry if that makes no sence i will clean it up when i have the time.
 
sorry if that makes no sence i will clean it up when i have the time.
 +
 +
 +
[[Category:Computer]]
 +
[[Category:Windows]]
 +
[[Category:Programming]]
 +
[[Category:Scripts]]

Latest revision as of 07:55, 26 February 2005

  • Sub matchRouterNames_RoutersTab_RCLDump_MGTIP()

Worksheets("RCL.Dump").Select

For y = 2 To 6

RouterName = Range("Routers!A" & y).Value & "-BVI1" Range("A1").Select

   Set x = Range("A:A").Find(What:=RouterName, After:=ActiveCell, LookIn:=xlValues, _
       LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=Falce)
   If x Is Nothing Then

Range("Routers!C" & y).Value = "not Found"

   Else
       Cells(x.Row, x.Column).Select
       FoundRow = x.Row
       Range("Routers!C" & y).Value = Range("B" & FoundRow).Value
   End If

Next y

Worksheets("Routers").Select

End Sub

this macro will get an index from one sheet, try to find it on another sheet and then will copy info back to the main sheet.


sorry if that makes no sence i will clean it up when i have the time.