Tigerexcel
Active Member
- Joined
- Mar 6, 2020
- Messages
- 493
- Office Version
- 365
- 2019
- Platform
- Windows
I would like to write a macro that prompts the user for a range of cells and then prompts for text/numbers and places those text/numbers in each of the cells from the chosen range.
Parts of this code work but it doesn't complete the job.
Sub Fill_range1()
Dim myValue As Variant
Dim UserRange As Range
On Error GoTo Canceled
Set UserRange = Application.InputBox(Prompt:="Please Select Range", Title:="Range Select", Type:=8)
myValue = InputBox("Enter information to be repeated")
Range(UserRange).Value = myValue
'AutoFit All Columns on Worksheet
ThisWorkbook.Worksheets("Sheet1").Cells.EntireColumn.AutoFit
If MsgBox("Do you wish to delete this selection", vbYesNo) = vbYes Then Range("a1:t1000").ClearContents
End Sub
Parts of this code work but it doesn't complete the job.
Sub Fill_range1()
Dim myValue As Variant
Dim UserRange As Range
On Error GoTo Canceled
Set UserRange = Application.InputBox(Prompt:="Please Select Range", Title:="Range Select", Type:=8)
myValue = InputBox("Enter information to be repeated")
Range(UserRange).Value = myValue
'AutoFit All Columns on Worksheet
ThisWorkbook.Worksheets("Sheet1").Cells.EntireColumn.AutoFit
If MsgBox("Do you wish to delete this selection", vbYesNo) = vbYes Then Range("a1:t1000").ClearContents
End Sub