User inputs a value which is then multiplied to fill a range

Jedit

New Member
Joined
Feb 8, 2013
Messages
27
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
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,215,581
Messages
6,125,656
Members
449,247
Latest member
wingedshoes

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top