Results 1 to 10 of 27

Thread: Avinash Crap Pending sorting out

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #15
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,402
    Rep Power
    10
    Hi,

    I think maybe you have got something mixed up or wrong….

    The macro you posted seems unnecessarily very complicate. It may be complicated for reasons and issues that I do not know about. That is why , as ever, it is always important for me to know where you got the macro from
    Where did you get this macro from?
    Are you sure that your explanation is correct? I think that is probably not what you want. If it is then that macro you posted is probably not the one that you meant to…


    Copy column B data of 1.xls and paste it to column C of basketorder.xlsx(exclude the header of column B of 1.xls and simply paste the rest data to column C of basketorder.xlsx
    = copy 1.xls B2:B5 to C1:C4 BasketOrder.xlsx

    If that is what you want , then you need just one code line like

    ' https://excelfox.com/forum/showthrea...ll=1#post14104
    Ws2.Range(“C1:C4”).Value = Ws1.Range(“B2:B5”)

    Or like

    ' https://excelfox.com/forum/showthrea...ll=1#post14100
    Ws1.Range(“B2:B5”).Copy
    Ws2.Range(“C1:C4”) .PasteSpecial Paste:= xlPasteValues


    That you have been doing that now for 2 years, here one example https://excelfox.com/forum/showthrea...ll=1#post14104
    https://excelfox.com/forum/showthrea...ll=1#post14100
    .
    I and others have shown you how to do that 100 times.
    ( And you just need to make the last row dynamic)



    Alan



    Code:
    Sub DimPigSht4Brains1()
    Dim Ws1 As Worksheet, Ws2 As Worksheet, Lr1 As Long, Lr2 As Long
     Set Ws1 = Workbooks("1.xls").Worksheets.Item(1): Set Ws2 = Workbooks("BasketOrder.xlsx").Worksheets.Item(1)
     Let Lr1 = Ws1.Range("A" & Ws1.Rows.Count).End(xlUp).Row: Let Lr2 = Ws2.Range("A" & Ws1.Rows.Count).End(xlUp).Row
     Let Ws2.Range("C1:C4").Value = Ws1.Range("B2:B5").Value
    End Sub
    
    
    
    Sub DimPigSht4Brains2()
    Dim Ws1 As Worksheet, Ws2 As Worksheet, Lr1 As Long, Lr2 As Long
     Set Ws1 = Workbooks("1.xls").Worksheets.Item(1): Set Ws2 = Workbooks("BasketOrder.xlsx").Worksheets.Item(1)
     Let Lr1 = Ws1.Range("A" & Ws1.Rows.Count).End(xlUp).Row: Let Lr2 = Ws2.Range("A" & Ws1.Rows.Count).End(xlUp).Row
     Ws1.Range("B2:B5").Copy
     Ws2.Range("C1:C4").PasteSpecial Paste:=xlPasteValues
    End Sub
    Last edited by DocAElstein; 07-19-2020 at 03:58 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

Similar Threads

  1. Replies: 14
    Last Post: 07-26-2020, 01:55 PM
  2. Excel Sheet Correction
    By johnny03 in forum Excel Help
    Replies: 1
    Last Post: 12-19-2014, 07:27 AM

Tags for this Thread

Posting Permissions

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