Array not pasting to next blank row

Enigmus345

Board Regular
Joined
Sep 9, 2014
Messages
97
Hello,
This is sort of a continuation from another post, to which, I've solved the original problem. I also thought it would be best to start a new thread for a new problem. I have code to paste an array of cells from sheet 1 (Main) to the first blank row on sheet 2 (Weekly Summary) starting in column B. I have the pasting working (which was the original problem) but I can't get new data to go to the next blank row, it only overwrites the existing data. Here is my code:
Code:
Private Sub CommandButton1_Click() 
Dim LR As Long, x As Integer, i As Long, cls
x = 1
While ThisWorkbook.Worksheets("Weekly Summary").Range("B" & x).Value <> ""
x = x + 1
Wend


cls = Array("AF8", "AG8", "AF14", "AG14", "AF20", "AG20", "AF29", "AG29", "AF35", "AG35", "AF41", "AG41", "AF45", "AG45", "AF47", "AG47")
With Sheets("Weekly Summary")
    LR = WorksheetFunction.Max(3, .Range("B" & x).End(xlUp).Row)
    For i = LBound(cls) To UBound(cls)
        .Cells(LR, i + 2).Value = Me.Range(cls(i)).Value
    Next i
End With


For Each nr In ActiveWorkbook.Names
    If nr.RefersToRange.Worksheet.Name = ActiveSheet.Name Then
        nr.RefersToRange.Value = ""
    End If
Next nr
End Sub

I'm really stuck. Any help at this point would be greatly appreciated.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

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