View Single Post
 
Old 04-14-2021, 04:05 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Try this
Code:
Sub Macro2()
  Dim str As String, aCell As Cell
  Selection.InsertColumns  'or InsertColumnsRight
  str = InputBox("What do you want in each cell?", "Feed Me", "Hi mum")
  For Each aCell In Selection.Cells
    aCell.Range.Text = str
  Next aCell
End Sub
If you have a userform open and you want the text value to come from the field you could change the str line to
str = Me.txtColumn
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote