Consulting

Results 1 to 5 of 5

Thread: Error

  1. #1

    Error

         If Worksheets("Vol").Column("A:B").Values <> "" Then
    Someone tell me the error for this coding please.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    As I said before, you cannot test multiple cells in this way.

    Explain what you are trying to achieve, not do, achieve.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3

  4. #4
    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.

  5. #5
    Oh no. So sorry, please refer to this new attached file instead of "1.xls".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •