LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default copy result to a specific location

Brilliant - works a treat

Thanks



"BrianB " wrote in message
...
You can change this as required :-

'-------------------------------------------
Dim MyValue As Variant
Dim FoundCell As Object
Dim FromSheet As Worksheet
Dim FromRow As Long
Dim ToSheet As Worksheet
Dim ToRow As Long
'---------------------
Sub transfer_data()
'- select cell containing search value
'- and run this macro from there
Set ToSheet = Workbooks("Book1.xls").Worksheets("Sheet1")
'**amend**
Set FromSheet = ActiveSheet
'------------------
MyValue = ActiveCell.Value
FromRow = ActiveCell.Row
'------------------
'- **nb. set correct column to search
Set FoundCell = ToSheet.Columns(1).Find(MyValue, LookIn:=xlValues)
If FoundCell Is Nothing Then
MsgBox (MyValue & " not found.")
Else
ToRow = FoundCell.Row
'- transfer additional data. **Change column numbers as
required.
ToSheet.Cells(ToRow, 5).Value = FromSheet.Cells(FromRow,
2).Value
ToSheet.Cells(ToRow, 6).Value = FromSheet.Cells(FromRow,
3).Value
End If
End Sub
'-------------------------------------------------


---
Message posted from http://www.ExcelForum.com/



 
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
Always print to a specific location Tommy-B[_2_] Excel Discussion (Misc queries) 0 June 15th 07 06:29 PM
How To always print to a specific Location Tommy-B[_2_] Excel Discussion (Misc queries) 0 June 15th 07 06:27 PM
Save to specific location LB79 Excel Discussion (Misc queries) 2 August 25th 05 11:02 AM
Need help in calculation at specific location Lewis Koh Excel Worksheet Functions 10 July 31st 05 04:35 PM
ListBox Result to a Specific Cell Location Randal W. Hozeski Excel Programming 1 December 30th 03 02:23 AM


All times are GMT +1. The time now is 07:20 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"