Macro Designing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a bunch of Macros for formatting and such. Can a Macro be made
to enter text?

Steve
 
Well, it's not clear what you're asking to do, but here's a part of a
macro which prompts a user for information and then inputs that
information into a specific cell.

Sub CalculateWACC()
Dim MyString1 As String
Worksheets("Analysis").Range("A1:A7").ClearContents

MyString1 = Application.InputBox("enter required or expected return on
equity")
Worksheets("Analysis").Range("A1") = MyString1
 
Sub entertext()
Range("d1").Value = InputBox("Enter text")
End Sub
 
I am trying to create a macro that will add two checkboxes Yes "box here" No
"Box here", with a Macros for with the set with the "Yes" checked and a Macro
with the set with the "No" checked, and so on to cover all the possible
combinations. I have successfully, about 5 minutes ago made a Macro to add
both boxes, but I could not change the boxes to have the check in them. I
delved into the VB side of the Macro but do not know what the
handler/switch/whatever it is called to indicate the box should be checked.

Here is the VB:
"Selection.TypeText Text:="YES "
Selection.FormFields.Add Range:=Selection.Range, Type:=wdFieldFormCheckBox
Selection.TypeText Text:=" NO "
Selection.FormFields.Add Range:=Selection.Range,
Type:=wdFieldFormCheckBox"

Basically how do I change: "Type:=wdFieldFormCheckBox" to show the yes box
checked?
 
Sub Insert_Active_CheckMark()
'
' By kStarbe !
'
Selection.FormFields.Add Range:=Selection.Range, Type:=wdFieldFormCheckBox
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
For Each fld In Selection.FormFields
With fld
.CheckBox.Value = True
End With
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top