PDA

View Full Version : Solved: macth and copy plus calculate before paste



protegeone
11-05-2005, 10:01 AM
Hi Everyone http://vbaexpress.com/forum/images/smilies/039.gif

I'm back again needing help.

Having this done this code so far
Sub kezd()
Dim SourceSh, TargetSh As Worksheet
Application.ScreenUpdating = False
Workbooks.Open ("C:\data.xls")

Set SourceSh = Workbooks("data.xls").Sheets("apple")
Set TargetSh = Workbooks("master.xls").Sheets("apricot")

For Each oCell In TargetSh.Columns("A:A").SpecialCells(xlCellTypeConstants, 3)
With SourceSh.Columns("A:A")
Set Src = .Find(oCell.Value, LookIn:=xlValues, LookAt:=xlWhole)
If Src Is Nothing Then
oCell.Offset(0, 6).Value = ""
Else
oCell.Offset(0, 6).Value = Src.Offset(0, 1).Value

End If
End With

Next oCell
ActiveWorkbook.Close False
Application.ScreenUpdating = True
End Sub



It works fine, matching columns in the two workbooks and copying value to
master workbook, but in addition to this, or rather instead what I'd like to achieve is to get value, multiply it with a fix number and place the result in the master workbook.
Tried all sorts of ways, but best I got were #VALUE! or #NAME! results.http://vbaexpress.com/forum/images/smilies/think.gif


Any help, hint appreciated.

Protege

Ken Puls
11-05-2005, 11:05 AM
You mean something like this?

Range("A1").Value = Range("A1").Value * 5

PS... welcome back! ;)

protegeone
11-05-2005, 02:46 PM
Yes. Exactly like that.. :doh: :doh: You just don't want to know how much time I've spent on this..

Thanks

Ken Puls
11-05-2005, 05:55 PM
LOL!

Not a problem at all. :)