Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Donna Thompson   on Oct 08 In MS Office Category.

  
Question Answered By: Emily Campbell   on Oct 08

Another thing that might be relevant is
finding some record  number or word in one list and moving
information from that record to another sheet.
For example, if you have a record with other information
connected to it on the same row
(e.g. "Record#" "Date" "Address" "Phone" "Item" each in columns),
you can find that same record number  on another sheet and move the
information in column 5 ("E" column, "Item") to the other page.
This sub allows you to find the selected record on the other
page, even if it's not on the same row as the first one (e.g. it
might find it on row 36 while the first sheet had it on row 10), and
moves the coresponding "Item" value to the 5th column on the
matching record on the other page.

Sub findmatchandmove()

Dim actVal
'<----the variable of the active record to be found
Dim newVal
'<---the variable of the value that needs to be moved
Dim fc
'<---variable for the found cell  that matches
Dim fndRrow
'<---variable for the row that matches
actVal = ActiveCell.Value
'<--- actVal is located in the active cell
newVal = ActiveCell(Offset, 5).Value
'<--- location of newVal, column 5
Set fc = Worksheets("Sheet2").Columns("A").Find(what:=actVal)
'<--finds it on the other sheet
fndRrow = fc.Row
'<--identifies the row it's on in the list
Sheets("Sheet2").Cells(fndRrow, 5).Value = newVal
'<---puts the value in column 5 of the newly found  row
MsgBox "Item information is now on Sheet2 on line = " & fndRrow
End Sub

Share: 

 

This Question has 9 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Search then go to particular cell Or get search suggestion and latest updates.


Tagged: