Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Copy/Paste to Specific Row with matching Value

I have a macro that works when matching both row and column values to paste a
value in a cell.
Now, I need to paste about 10 values into the same columns, but into the row
that has the right value.
Example: I want to paste the same 10 values from one workbook into a row in
another workbook that has the exact same Franchise number in Column A as the
Franchise number from the first worksheet (the numbers are in Column A, begin
on row 3 and start with 1 and go down to 200. Rows 1 & 2 have titles).
The code I'm usings seems like it's working, but nothing is happening on my
test of the first datapoint. Can someone help?
Here's the code I'm using...

Sub January()

Dim iOffice As Integer, iValue

wbData.Activate 'Data comes from here

With wbData.Sheets("Global & Monthly Inputs")
iOffice = .Range("B6")
iValueFN = .Range("B5")
'End With

' apply iValueFN - Variance to matched row

wbTarget.Activate 'Data goes to here

With wbTarget.Sheets("Monthly Data")
Dim lastrow As Long, lastcol As Long, xV As Long, xR As Long, xC As Long
lastrow = .Cells(Rows.Count, 1).End(xlUp).Row
'get matching row
For xV = 1 To lastrow
If iOffice = .Cells(xV, 1) Then xR = xV
Next xV
If xR = 0 Then MsgBox "Office: " & iOffice & " not found in summary Table"

If xR 0 Then .Cells(xR, 2) = iValueFN 'Column 2 (B) will always be
used for this value
End With
'Is not working to copy to specific row!!

End Sub


THanks!!

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
Copy / paste only specific rows Benjamin Excel Discussion (Misc queries) 3 April 11th 08 03:14 PM
Find matching date in another worksheet, copy and paste data Shoney Excel Discussion (Misc queries) 1 November 8th 07 11:45 PM
COPY AND PASTE SPECIFIC ROWS HERNAN Excel Discussion (Misc queries) 2 August 17th 06 07:32 PM
Copy and Paste specific data lizb22 Excel Programming 1 July 10th 06 09:28 PM
copy and paste matching by using ID's [email protected] Excel Programming 0 August 18th 05 10:18 AM


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