I have a macro that is used to split text in one cell into separate columns with a space delimiter. I want the macro to also autofit the columns after they are split, but the Call function I'm using gives me this error:
Argument not optional
Here is the code I am using:
Sub TextToCols(control As IRibbonControl) Worksheets("Sheet1").Activate Selection.TextToColumns DataType:=xlDelimited, _ ConsecutiveDelimiter:=True, Space:=True Call Autofit_Columns End Sub
And yes, There is a macro called Autofit_Columns in the worksheet:
Sub Autofit_Columns Dim sht As Worksheet 'AutoFit All Columns on Worksheet Columns.AutoFit End Sub
It's not a big deal to run the macros seperately, but I'd like to minimize clicking.
Thanks for any help.