Paste data in blank columns between columns with data

Sc0

New Member
Joined
Jul 12, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hello. I currently have some come where a workbook has 8 columns of data. I insert blank columns on this sheet X amount of times. For example one time I run the macro I may have 4 blank columns, the next time I may end up with 2 blank columns. The blank column will always start in cell C3. I would like to paste a vlookup in C3 and go to end of all blank cells. Then after the formula is filled across X columns, I would like to fill the formula down to the end of the data in column B if that makes sense. I have attached an example of what I have so far. Thanks!

VBA Code:
Sheets("Duplicates").Select
Range("B2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Active Price").Select
Range("C1").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True

Sheets("Active Price").Select
Range("C3").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC2&R2C,'F461 Current Price'!C9,1,FALSE)"
Range("C3").Copy


For j = 1 To col461
Sheets("Active Price").Select
On Error Resume Next
Range("C3", Range("C3")).End(xlToRight).SpecialCells(xlCellTypeBlanks).Select
On Error GoTo 0
    Range("C3").Select
        Range(Selection, Selection.End(xlToRight)).SpecialCells(xlCellTypeBlanks).Select
    'Selection.PasteSpecial Paste:=xlPasteAll
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,213,557
Messages
6,114,288
Members
448,563
Latest member
MushtaqAli

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