Copy from a worksheet

  • Trying to find a value in source sheet data column then copy a range to dest sheet data & paste the range to destination worksheet offset 1 column over.

    It can`t find the Value Electric in both sheets by the looks?


    And it seems to not like 2 Finds in the same code?

    Is that right? if so how can you overcome it?


    I`ve asked MrExcel but no reply today


    Copy from a worksheet | MrExcel Message Board

  • Attach an example workbook. It looks like you have a combobox, but why you are dimming it ?


    Both finds should work. This is untested


  • When you run the code it is highlighting problems, do you not look at these issues? There's one obvious error which I have corrected. Also a couple more that I have fixed.


    Where are the ListBoxes in the code?


  • The Combobox is on the 4th line then set on line 10

    This line says QDetials Variable not Defined but as far as i can see it is

    If QDetails_Details.List(i, 1) = ("Boxer") & "" & QDetails_Details.List(i, 4) = ("L2") & "" & QDetails_Details.List(i, 2) = ("Single") Then

  • Yes, but where is it. Is it on the UserForm. On Friday I posted


    Quote


    Attach an example workbook. It looks like you have a combobox, but why you are dimming it ?

    You still have provided a reply that helps.

  • That's not how you do it.


    You need use something, replace the userform and control names.


    Code
    UserForm1.ComboBox1.List=

    I don't see why you don't put that code in the UserForm module.

  • I've added it to the form as you said.

    How can you make the below code work taking various combined values of ComboBox?

    Seems that except for that it`s working?



    Code
    For x = 0 To Me.Quote_Details.ListCount - 1
    If Me.Quote_Details.Selected(x) Then
    If Me.Quote_Details.List(x, 1) = ("Boxer") & "" & Me.Quote_Details.List(i, 4) = ("L2") & "" & Me.Quote_Details.List(i, 2) = ("Single") Then
    RngSource("A72:O78").Copy Destination:=Addme
    End If
    End If
    Next x
  • What are you actually trying to do?


    Quote_Details is a ListBox. I would think you need to use x not i


    Code
      For x = 0 To Me.Quote_Details.ListCount - 1
    If Me.Quote_Details.Selected(x) Then
    If Me.Quote_Details.List(x, 1) = ("Boxer") & "" & Me.Quote_Details.List(x, 4) = ("L2") & "" & Me.Quote_Details.List(x, 2) = ("Single") Then
    RngSource("A72:O78").Copy Destination:=Addme
    End If
    End If
    Next x
  • What I am trying to do is below.

    Trying to find a value in source sheet data column then copy a range to dest sheet data & paste the range to destination worksheet offset 1 column over.

    It`s found by the multiple column choices made on the Listbox.

  • Your code was using two different rows in the ListBox based on x & i. I would think you need to use the same row, i.e. x, the selected row.

  • This code below says Invalid List Property??

    Code
    If Me.Quote_Details.List(x, 1) = ("Boxer") & "" & Me.Quote_Details.List(x, 4) = ("L2") & "" & Me.Quote_Details.List(x, 2) = ("Single") Then
  • Have you debugged your code?


    I can't load the userform because it requires connecting to a folder.


    When I remove that code I get a Next without For error in the Initialize event.


    I get an error in that line because as I have already said you cannot refer to the ListBox that way.


    Even when I fix that error another one occurs.


    I've fixed the errors but I have no idea what you expect.


    The whole code needs reviewing.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!