Hi,
So, I’m struggling here with a macro that I supposed to Copy a range of Cells A6 to AJ6
From one sheet to another.
However, on the next sheet it should find the next empty row from row 18-32.
And say that data in a row is later deleted, the next entry will find that row and fill in the data here, instead of continuously going downwards.
The macro im working with looks like this:
Sub Legg_til_Innkjøp()
Worksheets("Innkjøp").Range("A18").FormulaR1C1 = "=TODAY()"
Worksheets("Lagerstatus").Unprotect Password:="Norskmodul123"
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Dim lr As Long
Set copySheet = Worksheets("Innkjøp")
Set pasteSheet = Worksheets("Lagerstatus")
copySheet.Range("A6:AJ6").Copy
lr = pasteSheet.Range("A18").End(xlDown).Row
pasteSheet.Range("A" & lr + 1).PasteSpecial xlValues
Application.CutCopyMode = False
Worksheets("Lagerstatus").Protect Password:="Norskmodul123"
Range("A6:AJ6").ClearContents
End Sub
So, I’m struggling here with a macro that I supposed to Copy a range of Cells A6 to AJ6
From one sheet to another.
However, on the next sheet it should find the next empty row from row 18-32.
And say that data in a row is later deleted, the next entry will find that row and fill in the data here, instead of continuously going downwards.
The macro im working with looks like this:
Sub Legg_til_Innkjøp()
Worksheets("Innkjøp").Range("A18").FormulaR1C1 = "=TODAY()"
Worksheets("Lagerstatus").Unprotect Password:="Norskmodul123"
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Dim lr As Long
Set copySheet = Worksheets("Innkjøp")
Set pasteSheet = Worksheets("Lagerstatus")
copySheet.Range("A6:AJ6").Copy
lr = pasteSheet.Range("A18").End(xlDown).Row
pasteSheet.Range("A" & lr + 1).PasteSpecial xlValues
Application.CutCopyMode = False
Worksheets("Lagerstatus").Protect Password:="Norskmodul123"
Range("A6:AJ6").ClearContents
End Sub