PDA

View Full Version : Error



TheAnswer
11-23-2010, 03:09 AM
If Worksheets("Vol").Column("A:B").Values <> "" Then

Someone tell me the error for this coding please.

Bob Phillips
11-23-2010, 03:44 AM
As I said before, you cannot test multiple cells in this way.

Explain what you are trying to achieve, not do, achieve.

TheAnswer
11-23-2010, 06:18 PM
"2.xls"

TheAnswer
11-23-2010, 06:21 PM
I am trying to put in all the values from "2.xls" into "1.xls".

Private Sub CommandButton1_Click()


Dim oneCell As Range
Dim rRow As Integer, DRow As Integer
Dim aTemp As String
Workbooks("2.xls").Activate
rRow = Range("B65536").End(xlUp).Row
For Each oneCell In Range("B1:B" & rRow).Cells
aTemp = Application.VLookup(oneCell.Value, Workbooks("1.xls").Worksheets("Sheet1").Range("A:B"), 2, 0)
If Not (IsError(aTemp)) Then
If Not (IsError(Application.Match(aTemp, Range("D:D"), 0))) Then 'it matched the B cell with the D one on row DRow
DRow = Application.Match(aTemp, Range("D:D"), 0)
Workbooks("2.xls").Worksheets("Sheet1").Range("A:A").Copy Destination:=Workbooks("1.xls").Worksheets("Sheet1").Range("D1")
End If
End If
Next
End Sub

I have this coding so far. It is taught by a kind soul from this forum.

TheAnswer
11-23-2010, 11:12 PM
Oh no. So sorry, please refer to this new attached file instead of "1.xls".