Filling in Missing Data by Copying Down

swimfool

New Member
Joined
Feb 28, 2011
Messages
1
I have a download of information with our members prior 12 month golf scores and their handicap differentials. The Name and other certain key information is shown only on the first row of data.

Thus I'm attempting to copy this key information onto the blank rows below to match the column information that has various scores on it so we can then analyze the scores. The number of Rows can vary from member to member, depending on number of games our member has played in the past year.

Per my 1st attempt at the Macro below I'm trying to adjust by rather than have specific cells - tell my Macro to Start at B3 - I can place the cursor there before starting - copy the next 3 columns or 4 columns in total to the blank line below by using the END key to go down to next filled in Row and then up 1 Row and Past. Then END Down to next member and do the same.

Finally I need to create a Sub Routine to tell this to do it 400 times - our member total.

ANY IDEAS! THANKS in Advance :cool:

Sub Macro1()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+a
'
Range("B3:E3").Select
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
Range("B3:E9").Select
ActiveSheet.Paste
Selection.End(xlDown).Select
Range("B10:E10").Select
Application.CutCopyMode = False
Selection.Copy
Range(Selection, Selection.End(xlDown)).Select
Range("B10:E18").Select
ActiveSheet.Paste
Selection.End(xlDown).Select
Range("B19:E19").Select
Application.CutCopyMode = False
Selection.Copy
Range("B20").Select
End Sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi and welcome.

Try something like this...
Code:
Sub Fill()

    Dim Target As Range, TargetBlanks As Range, Lastrow As Long
    
    ' Last used row on the sheet
    Lastrow = Cells.Find("*", , , , xlByRows, xlPrevious).Row
    
    Set Target = Range("B3")    ' Start
    
    Application.ScreenUpdating = False
    
    Do
        Set TargetBlanks = Target.End(xlDown)
        If TargetBlanks.Row > Lastrow Then Set TargetBlanks = Cells(Lastrow, Target.Column)
        Set TargetBlanks = Range(Target, TargetBlanks).SpecialCells(xlCellTypeBlanks)
        
        ' Fill in blank cells below (Columns B, C, D, and E)
        Target.Resize(, 4).Copy Destination:=TargetBlanks.Resize(, 4)
        
        Set Target = Target.End(xlDown)
        
    Loop Until Target.Row >= Lastrow
    
    Application.ScreenUpdating = True
    
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,849
Members
452,948
Latest member
UsmanAli786

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