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

Hi,

I have a worksheet (PayCalc) that calculates a persons wages for a
particular project. All I enter is the Employees ID No.

Each time I change the ID No the Total figure changes - my problem is that I
want to keep the calculated figure for use in the future.

I have another sheet (EmpInfo) that has lots of info stored by ID No. how
can I copy the calculated figure to the Pay column in this worksheet based
on ID No? I don't particularly want to have to copy it manually each time.

Here is what I think needs to be done (but I could be wrong!)

Step 1 Copy the calculated figure

Step 2 Lookup the Row Number for the correct ID No in the EmpInfo worksheet

Step 3 Paste the value of the calculated figure in the Pay column of the Row
Number found in step 2

Is this possible? if so, how

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copy result to a specific location

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 a
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

  #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/



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
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 04:26 AM.

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"