I have tried the following:
Function numbCols(countrows) As Integer
Dim shtAnnual As Worksheet
Dim rng As Range
Dim numCols As Integer
Dim txtInbox As String
Set shtAnnual = ActiveSheet
'activate the first cell as a starting point for counting non-empty rows
shtAnnual.Cells(1, 1).Activate
Set rng = ActiveCell
'Loop until an empty cell is found.
Do While rng.Value <> ""
numCols = numCols + 1
Set rng = rng.Offset(0, 1)
Loop
numbCols = numCols
shtAnnual.Cells(0, 15).Activate
Set rng = ActiveCell
txtInbox = InputBox("Result Column", "Parse Result", "Please enter what column name you want for the result column")
rng.Cells = txtInbox
End Function
The error I got is: Application-defined or object-defined error on this line: shtAnnual.Cells(0, 15).Activate
Is it because I have activated twice in the same function?
ljCharlie