dimanche 7 octobre 2018

Copying columns including blanks without skipping rows..leave "blanks" blank VBA

enter image description hereCopying a specified column and range including blanks with an embedded button running multiple Macros. I know that all rows will be filled in column A so if I could reference the rest of the Macros to A.end

I've looked Google youtube and here although there is a lot of info on copying and pasting, I cannot find one that works for this running multiple Macros.

Macros 5 & 6 is where I start having problems because these columns have multiple blanks throughout.

Raw data to Copy:

Sheet1

Destination:

Sheet2

Private Sub CommandButton1_Click()

Worksheets("Sheet1").Range("a2", Range("a2").End(xlDown)).Copy _
        Worksheets("Sheet2").Range("a2") 'macro1

Worksheets("Sheet1").Range("d2", Range("d2").End(xlDown)).Copy _
        Worksheets("Sheet2").Range("b2")  'Macro2

Worksheets("Sheet1").Range("c2", Range("c2").End(xlDown)).Copy _
        Worksheets("Sheet2").Range("c2") 'macro3

Worksheets("Sheet1").Range("g2", Range("g2").End(xlDown)).Copy _
        Worksheets("Sheet2").Range("d2") 'macro4


If Worksheets("Sheet1").Range("e2", Range("e2").End(xlDown)).Value = "<0" Then
    Worksheets("Sheet2").Range("i2").Copy  'macro5

If Worksheets("Sheet1").Range("e2", Range("e2").End(xlDown)).Value = ">0" Then
        Worksheets("Sheet2").Range("j2").Copy 'macro6

Worksheets("Sheet2").Activate 'macro7

Aucun commentaire:

Enregistrer un commentaire