Some basic VBA Excel scripting questions

Brass Contributor

Hey,

 

I would like to copy the entire contents of one Excel sheet from one project to a different sheet in a different project, using VBA scripting. How would I do this?

 

Then, I would like to copy all the entries from the first two columns which are both non-blank (i.e., if a row has an entry in the first and second column, copy both, but if either column is blank, skip the entire row) and paste those entries to a second sheet.

 

How might I do this?

 

Thank you.

2 Replies

 

 

Sub CopyValuesFromOneSheetToAnotherSheet()

    With Worksheets("Source").Range("A1").CurrentRegion
        .Offset(1).Resize(.Rows.Count - 1).Copy _
        Worksheets("Destination").Range("A" & Rows.Count).End(xlUp).Offset(1)
    End With
   
End Sub

 

@jukhamil 

@Juliano-Petrukio 

 

See example attached.