The error is:
error: Invalid Outside Procedure
Code:
Sub MyProcedure()
a = Worksheets("ark1").Cells(Rows.Count, 1).End(xlUp).Row
MsgBox (a)
End Sub
my first sheet is called Ark2 and my updated sheet is called Ark1. my first row i wanted to move, is a string and called "nøgletal", my other column is called år and it is integers. i wanted to move all date within cell´s ranging from c2 to c16 and b2 to b16, to the other sheet.
i am now getting the error on line 4 " nøgletal = Range("B2:B16")"
Private Sub CommandButton1_Click()
Dim nøgletal As String, år As Integer
Worksheets("Ark2").Select
nøgletal = Range("B2:B16")
år = Range("C2:C16")
Worksheets("Ark1").Select
Worksheets("Ark1").Range("A4").Select
If Worksheets("Ark1").Range("A4").Offset(1, 0) <> "" Then
Worksheets("Ark1").Range("A4").End(xlDown).Select
End If
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = nøgletal
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = år
Worksheets("Ark2").Select
Worksheets("Ark2").Range("B2", "B16").Select
End Sub