Exclude Blank Rows in VBA copy/paste

jojo_lisac

New Member
Joined
May 15, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I've set up a macro to copy data from one Workbook to another. The problem I'm having is that the data changes each time so I might have 1 row or 11 rows. I want to make sure I copy over all of the non-blank rows, but if it includes the blank rows, my upload is failing because the platform I'm uploading to sees the blank rows I've copied over and thinks there's missing data.

I've changed skip blanks to true, but that's not working.


How do I only select non-blank rows while still making sure I'm in the range of rows 3-13?



Windows("Worksheet1.csv").Activate

Range("A2").Select

Windows("Wooksheet2.xlsm").Activate

Rows("3:13").Select

Selection.Copy

Windows("Worksheet1").Activate

Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _

xlNone, SkipBlanks:=True, Transpose:=False

Application.CutCopyMode = False


Thanks in advance!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
If you run this, are the so called empty cells in Column A red? If not, the cells are not really empty. Happens quite often when data is imported.
Change range reference if required.
Code:
Sub Color_Empties_Red()
    ActiveSheet.Range("A3:A13").Resize(, ActiveSheet.UsedRange.Columns.Count).SpecialCells(4).Interior.Color = vbRed
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,602
Members
449,089
Latest member
Motoracer88

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