-
Solved: Copy rows from one sheet to another.....
Two Flaps (A & B) - same formats.
If Cell below heading in Flap B is Blank - exit sub
If Cell below heading in Flap B has information - then copy all rows below heading in Flap B - into Flap A below last row available.
Problem - Cell below Heading in Flap A could be empty
Kindly help
[VBA]Sub copy_rows()
If Sheets("Flap-B").Range("A3") = "" Then
Exit Sub
Else
' Do Something Here
Sheets("Flap-B").Select
Range("A65536").End(xlUp).Select
' Do Something Here
End If
End Sub[/VBA]
-
Does this do what you want?
[VBA]Sub copy_rows()
Dim sA As Worksheet, sB As Worksheet, rCopy As Range
Set sA = Sheets("Flap-A")
Set sB = Sheets("Flap-B")
If sB.Range("A3") = "" Then
Exit Sub
Else
If sA.Range("A2") <> "" Then
Range(sB.Range("a3"), sB.Range("a3").End(xlToRight).End(xlDown)).Copy _
sA.Range("A" & Rows.Count).End(xlUp).Offset(1)
Else
Range(sB.Range("a2"), sB.Range("a3").End(xlToRight).End(xlDown)).Copy _
sA.Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
End If
End Sub[/VBA]
-
Hey Barron,
Thx for the code - it perfect.
Best regards
-
can you modify this so that if FlabB is copied, it loos in futher sheets if there is data in a specific range?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules