Insert value based on amount pasted

The Power Loon

New Member
Joined
Feb 7, 2020
Messages
34
Office Version
  1. 365
Platform
  1. Windows
I have a VBA codes that pulls dozens of different categories of data, based on filters, from various columns in a source table in one sheet and then pastes them all into column C in another sheet. My issue is that once pasted into column C, it's impossible to distinguish which category the data belongs to. There are no corresponding designations in the source data I can paste with it, and the amount of data pasted varies.

What I'm trying to do is add a line in the VBA code, immediately after each pasting action, that will add a designation into column A aligning with the just pasted values. I've tried some offsets, but just can't get it figured out. Below is a sample of code for one of the filters. Is this possible?

ActiveSheet.ListObjects("Table4").Range.AutoFilter Field:=12, Criteria1:= _
">=.001", Operator:=xlAnd
Range("Table4[1st to 2nd]").Select
Range("B5").Activate
Selection.Copy
Sheets("Records").Select
Range("C1").End(xlDown).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Add "Filter Set 1" to Column A in the corresponding row of each newly pasted value.
Sheets("All Combinations").Select
ActiveSheet.ListObjects("Table4").Range.AutoFilter Field:=12
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,214,636
Messages
6,120,668
Members
448,977
Latest member
moonlight6

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