Where does the original macro come from
What is it supposed to do
Where does the original macro come from
What is it supposed to do
….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!!
I got this macro in 2019 & I have not remebered from which forum i got this macro
I am sending the sample file plz give me some time
….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!!
Code:Sub STEP7() Dim Wb1 As Workbook Dim wb3 As Workbook Dim Ws1 As Worksheet Dim ws3 As Worksheet Dim strPath As String Dim r As Long Dim m As Long Dim rng As Range Dim n As Long Application.ScreenUpdating = False Set Wb1 = Workbooks.Open(ThisWorkbook.Path & "\1.xls") Set Ws1 = Wb1.Worksheets(1) m = Ws1.Range("B" & Ws1.Rows.Count).End(xlUp).Row strPath = ThisWorkbook.Path & "\" Set wb3 = Workbooks.Open(strPath & "BasketOrder..csv") Set ws3 = wb3.Worksheets(1) Set rng = ws3.Range("C:C").Find(what:="*", searchorder:=xlByRows, SearchDirection:=xlPrevious) If rng Is Nothing Then n = 1 Else n = rng.Row + 1 End If For r = 2 To m ws3.Range("C" & n).Value = Ws1.Range("B" & r).Value n = n + 1 Next r Application.DisplayAlerts = False wb3.SaveAs FileName:=strPath & "BasketOrder..csv", FileFormat:=xlCSV wb3.Close SaveChanges:=False Wb1.Close SaveChanges:=False Application.DisplayAlerts = True Application.ScreenUpdating = True End Sub
I have this macro which is working perfect but i converted the basketorder..csv to basketorder.xlsx so i need the modification according to that
plz see the sample file
condition: 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 )
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!!
Yes i tried by both methods but i am unable to solve it
I tried by the code also which u shared the link & it was similar to this but there is small change between both macros & i am unable to solve the same
So plz help
Code:Sub DimPigSht4Brains1() Dim Ws1 As Worksheet, Ws2 As Worksheet, Lr1 As Long, Lr2 As Long Set Ws1 = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\sample1.xls").Worksheets.Item(1): Set Ws2 = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\sample2.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("C:C").Value = Ws1.Range("B2:B").Value End Sub
You don’t seem to have read or understood anything I wrote, and your last reply is total rubbish and nonsense.
Go back to post 2, https://excelfox.com/forum/showthrea...ll=1#post14665 , take your time, and try again
I am not going to keep wasting my time saying the same thing over and over again! , and think before you post! , - don’t just post any rubbish and nonsense in the hope that we will magically guess what it is you want
Last edited by DocAElstein; 07-19-2020 at 05:33 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!!
Last edited by fixer; 07-21-2020 at 02:13 PM.
Code:Sub STEP7() Dim Wb1 As Workbook Dim wb3 As Workbook Dim Ws1 As Worksheet Dim ws3 As Worksheet Dim r As Long Dim m As Long Dim rng As Range Dim n As Long Application.ScreenUpdating = False Set Wb1 = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\1.xls") Set Ws1 = Wb1.Worksheets(1) m = Ws1.Range("B" & Ws1.Rows.Count).End(xlUp).Row Set wb3 = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\BasketOrder.xlsx") Set ws3 = wb3.Worksheets(1) Set rng = ws3.Range("C:C").Find(what:="*", searchorder:=xlByRows, SearchDirection:=xlPrevious) If rng Is Nothing Then n = 1 Else n = rng.Row + 1 End If For r = 2 To m ws3.Range("C" & n).Value = Ws1.Range("B" & r).Value n = n + 1 Next r Application.DisplayAlerts = False wb3.Close SaveChanges:=True Wb1.Close SaveChanges:=False Application.DisplayAlerts = True Application.ScreenUpdating = True End Sub
Problem Solved
Thnx Alot Doc Sir for helping me in solving this Problem
Have a Great Day
The macro you posted in your last post , and the macro at the cross post where you appeared to have a solution, and everything you posted here are all different things.
You are posting a lot of mixed up nonsense ,
Last edited by DocAElstein; 07-22-2020 at 11:59 AM.
….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!!
Bookmarks