Copy, Paste in New Sheet, Remove Duplicates VBA

beginvbaanalyst

Board Regular
Joined
Jan 28, 2020
Messages
141
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

I had an idea to create a multi step process for my business.
Created a custom template provided below:
1581175015953.png

I want to pull data from column that have a yellow box and assortments (A:B) to whatever row it's filled down to. Paste this data into a new sheet, continue to execute for (E:F), (I:J), (M:N) and etc then remove duplicate values for a validation step at the very end.
Would my code look something like this?
VBA Code:
Range ("A2:B", Range("B" & Row.Count).End(xlUp)).Row
Sheet("Sheet1").Copy after:=("Sheet1")
ActivateSheet.Name = "PV LIST"

Worksheets('Sheets1").Activate
Range ("E2:F", Range("F" & Row.Count).End(xlUp)).Row

^I think this is completely wrong but I hope I have some sort of idea
I would like to paste below the data I took from A and B without it removing anything into my new sheet.
Is this possible?
 
I cannot trouble shoot it from here. It ran OK in my test set up. What that line of code does is create a column reference based on the value of 'i' for that iteration in the loop, So if it is copying any of the columns and then throwing the error, it is probably because the value for i is for a column number that exceeds the last column of the used range. In and earlier post I asked what the last column to be copied was and never got an answer, so I just used the last column of row 1. That may or may not bee a good number.
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
I cannot get oit to djuplicate the error based on what I thought might be causing it. I tried with varying numbers of columns and it worked as expected without error in my set up. So, without being able to check it on the actual sheet, I don't have an answer.
 
Upvote 0
I cannot get oit to djuplicate the error based on what I thought might be causing it. I tried with varying numbers of columns and it worked as expected without error in my set up. So, without being able to check it on the actual sheet, I don't have an answer.

How can I share you a file of my excel document?
 
Upvote 0
How can I share you a file of my excel document?
This site does not allow uploads to its server so you would have to use something like 'Dropbox' and then provide a link in the the reply box of this thread. Be sure you mark it to share.l
 
Upvote 0
There is something wrong with the link. It only takes me to Dropbox sign in, not the file.
 
Upvote 0

Forum statistics

Threads
1,216,096
Messages
6,128,807
Members
449,468
Latest member
AGreen17

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