Filling in blank rows

J

Jenny B.

I posted this originally on the 15th, but only received one response and I’m
hoping for a little further information.

I’m moving data from one page to another (moving inactive data from the
Active Page to the History Page). Since moving data is on a line by line
basis, the Active Page will contain several blank rows after other rows have
been removed (transferred to the History Page). I’m wondering if there is a
way to “step up†the remaining rows (that contain data) in the Active Page
without compromising the original Macro’s settings.

Below is the Macro I am using to move the data from the Active Page to the
History. I’ve provided just 2 lines of the code, but I plan to continue this
same format for about 30 lines of data.

Thank you for your review and any further help would be greatly appreciated
– Jenny B.

_________________________________________________________________________--

Private Sub Worksheet_SelectionChange (ByVal Target As Range)
Application.ScreenUpdating = False
If Not Intersect(Target, Range("b3")) Is Nothing Then
Sheets("History").Range("a3:x3").Insert shift:=xlDown
Range("d3:aa3").Copy Destination:=Sheets("History").Range("a3:x3")
Range("C3:AB3").Select
Range("AB3").Activate
Selection.ClearContents
Range("c3").Select
Application.ScreenUpdating = True
ElseIf Not Intersect(Target, Range("b4")) Is Nothing Then
Application.ScreenUpdating = False
Sheets("History").Range("a3:x3").Insert shift:=xlDown
Range("d4:aa4").Copy Destination:=Sheets("History").Range("a3:x3")
Range("C4:AB4").Select
Range("AB4").Activate
Selection.ClearContents
Range("c4").Select
Application.ScreenUpdating = True
End If
End Sub
 
K

kassie

Apart from the fact that you can shorten your code a lot by utilising a loop,
why not just delete the moved rows, instead of clearing the data and leaving
empty rows?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top