Combining macros into one

oblix

Board Regular
Joined
Mar 29, 2017
Messages
183
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
  6. 2011
  7. 2010
  8. 2007
  9. 2003 or older
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
Hi there I have figured out to past values from one sheet to the other
unortunately only figured out one column at a time.
Please asisst to combine these macro as one

Sub Issue_product()
Sheets("D1").Range("bo2:bo200").Copy
Sheets("Issued").Cells(Rows.Count, "c").End(xlUp).Offset(1). _
PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False
End Sub

Sub Issue_Date()
Sheets("D1").Range("bm2:bm200").Copy
Sheets("Issued").Cells(Rows.Count, "b").End(xlUp).Offset(1). _
PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False
End Sub

Sub Issue_price()
Sheets("D1").Range("bv2:bv200").Copy
Sheets("Issued").Cells(Rows.Count, "d").End(xlUp).Offset(1). _
PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False
End Sub

Sub Issue_qty()
Sheets("D1").Range("bw2:bw200").Copy
Sheets("Issued").Cells(Rows.Count, "e").End(xlUp).Offset(1). _
PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False
End Sub
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
One way it so simply put all your blocks of code into one procedure, i.e.
Rich (BB code):
Sub Issue_product()
Sheets("D1").Range("bo2:bo200").Copy
Sheets("Issued").Cells(Rows.Count, "c").End(xlUp).Offset(1). _
PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False
End Sub

Sub Issue_Date()
Sheets("D1").Range("bm2:bm200").Copy
Sheets("Issued").Cells(Rows.Count, "b").End(xlUp).Offset(1). _
PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False
End Sub

Sub Issue_price()
Sheets("D1").Range("bv2:bv200").Copy
Sheets("Issued").Cells(Rows.Count, "d").End(xlUp).Offset(1). _
PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False
End Sub

Sub Issue_qty()
Sheets("D1").Range("bw2:bw200").Copy
Sheets("Issued").Cells(Rows.Count, "e").End(xlUp).Offset(1). _
PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False
End Sub
 
Upvote 0
VBA Code:
Sub Issue_product()[/B]
Sheets("D1").Range("bo2:bo200").Copy
Sheets("Issued").Cells(Rows.Count, "c").End(xlUp).Offset(1). _
PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False

Sheets("D1").Range("bm2:bm200").Copy
Sheets("Issued").Cells(Rows.Count, "b").End(xlUp).Offset(1). _
PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False

Sheets("D1").Range("bv2:bv200").Copy
Sheets("Issued").Cells(Rows.Count, "d").End(xlUp).Offset(1). _
PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False

Sheets("D1").Range("bw2:bw200").Copy
Sheets("Issued").Cells(Rows.Count, "e").End(xlUp).Offset(1). _
PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False
End Sub
 
Upvote 0
How about
VBA Code:
Sub oblix()
With Sheets("Issued")
   .Range("C" & Rows.Count).End(xlUp).Offset(1).Resize(199).Value = Sheets("D1").Range("bo2:bo200").Value
   .Range("B" & Rows.Count).End(xlUp).Offset(1).Resize(199).Value = Sheets("D1").Range("bm2:bm200").Value
   .Range("D" & Rows.Count).End(xlUp).Offset(1).Resize(199).Value = Sheets("D1").Range("bv2:bv200").Value
   .Range("E" & Rows.Count).End(xlUp).Offset(1).Resize(199).Value = Sheets("D1").Range("bw2:bw200").Value
End With
End Sub
 
Upvote 0
Solution
Thank you o the quick reply
only now I see the flaw in my very own code
after running your samples the things are pasted on all the wrong rows.
maybe need to explain for more assitance
The ange i am oping om is an advanced filter result
So if I hange the date it iltes and I want to copy those results....I change date i iltes again and want to opy again..and so on.
my macros must look in the row for values in those columns and then paste.
Currently it looks fo one column and pastes it. when i run for the second time i pastes the next podut but the est i pastes in the ow after the podut was pasted?
cant explain it better. so it dosnt paste the qty and price in the right row for the second and all other pastes.
 
Upvote 0
I realy liked the sub Oblix naming Fluff
going to keep that as the sub name
 
Upvote 0
sorry sticky key board..only see the typos now....

Thank you for the quick reply
only now I see the flaw in my very own code
after running your samples the things are pasted on all the wrong rows.
maybe need to explain for more assitance
The range i am copying fom is an advanced filter result
So if I change the date it filters and I want to copy those results....I change date and it filters again and want to copy again..and so on.
my macros must look in the row for values in those columns and then paste.
Currently it looks fo one column and pastes it. when i run for the second time i pastes the next produt but the rest it pastes in the row after the produt was pasted?
cant explain it better. so it doesnt paste the qty and price in the right row for the second and all other pastes.
 
Upvote 0
Maybe
VBA Code:
Sub oblix()
With Sheets("Issued")
   With .Range("B" & Rows.Count).End(xlUp).Offset(1)
      .Resize(199).Value = Sheets("D1").Range("bm2:bm200").Value
      .Offset(, 1).Resize(199).Value = Sheets("D1").Range("bo2:bo200").Value
      .Offset(, 2).Resize(199).Value = Sheets("D1").Range("bv2:bv200").Value
      .Offset(, 3).Resize(199).Value = Sheets("D1").Range("bw2:bw200").Value
   End With
End With
End Sub
 
Upvote 0
my appoligies
the first one worked, the problem was if hen statements that took empty cells to 0 and not "". when I changed that, it all works.
so thank you Fluff yours seem to work well
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,823
Messages
6,121,777
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top