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:
I'm really stuck. Any help at this point would be greatly appreciated.
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.