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