I'm pretty new to Excel VBA. So far I've read and learned a lot on this site, but haven't found a solution for my problem.
As part of a macro I have the following code:
With Worksheets("Oracle")
On error resume next
ActiveWorkbook.Names("bron").Delete
ActiveWorkbook.Names.Add Name:="bron", RefersTo:= Range("A1", Range("A1").End(xlToRight).End(xlDown))
.Cells.Select
With Selection.Font
.Name = "Verdana"
.FontStyle = "Standaard"
.Size = 8
End With
.Range("A1", Range("A1").End(xlToRight)).Font.Bold = True
MsgBox "Tabblad ‘Oracle’ is klaar!", vbOKOnly
End With
I understand that with the first line of the code it shouldn't matter what the active sheet actually is. But the problem is it only works when Oracle is the active sheet. What have I done wrong?