Good Afternoon
I am attempting to create a macro where the message box appears and ask the user for a number of days. That number is then multiplied by 24.
The first thing my macro does is take calls A2:A24 and merges those cells together.
Next the macro will prompt the user for a value. The user then enters the value and the resulting code should resemble A2: A24 * (user value).
I have pasted my current code below:
Range("A2:A24").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Dim myColm As Long
myColm = Application.InputBox("How many days are there?", Type:=2)
If myColm = 0 Then Exit Sub Else myColm = myColm
Range("A2:A24").Select
Selection.AutoFill Destination:=Range("A2:A " & myColm & * 7 " "), Type:=xlFillDefault
My error occurs around the selection.autofill destination line.
What is the correct formatting for the last line or is my code completely incorrect?
Thank you for any information you can provide me.
Sincerely,
Jedit
I am attempting to create a macro where the message box appears and ask the user for a number of days. That number is then multiplied by 24.
The first thing my macro does is take calls A2:A24 and merges those cells together.
Next the macro will prompt the user for a value. The user then enters the value and the resulting code should resemble A2: A24 * (user value).
I have pasted my current code below:
Range("A2:A24").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Dim myColm As Long
myColm = Application.InputBox("How many days are there?", Type:=2)
If myColm = 0 Then Exit Sub Else myColm = myColm
Range("A2:A24").Select
Selection.AutoFill Destination:=Range("A2:A " & myColm & * 7 " "), Type:=xlFillDefault
My error occurs around the selection.autofill destination line.
What is the correct formatting for the last line or is my code completely incorrect?
Thank you for any information you can provide me.
Sincerely,
Jedit