That works awesome -- thank you! One last question
Now that I have this working for this tab I noticed that when I hit the
macro button in another tab it's formatting that tab on not this new
tab?
How do I add the right coding to this so that it formats the
[TermSummary]
tab not the [SourceCode] tab?
Thanks again -- this is a huge help!!! :>
Sub CreateTerm()
Dim ws As Worksheet
Set ws = gettab("TermSummary")
Dim rPart As Range
Dim Target As Range
With ws
' Formats the Column widths
Columns("B:B").ColumnWidth = 20
Columns("C:C").ColumnWidth = 30
' Formats the Currency
.Range("D
").Select
Selection.NumberFormat = "#,##0_);[Red](#,##0)"
' Enters the Discount Allocation
.Range("G1") = "Apply Discount"
.Range("H1").Value = InputBox("What percentage") / 100
.Range("H1").NumberFormat = "0.00%"
.Range("H1").Interior.ColorIndex = 6
' Enters the Currency
.Range("B3") = Worksheets("Source Code").Range("A4")
.Range("C3") = Worksheets("Source Code").Range("B4")
' Enters the # of Users
.Range("B4") = "Users"
.Range("C4") = Worksheets("Source Code").Range("B5")
' Enters the Platform Type
.Range("B5") = "Platform/Edition"
.Range("C5") = Worksheets("Source Code").Range("A12")
.Range("D5") = Worksheets("Source Code").Range("B12")
' Enters the Addtl part numbers
Set Target = .Range("B6")
End With
Set rPart = Worksheets("Source Code").Range("B17")
Do Until rPart = ""
Target.Offset(, 1) = rPart.Offset(, -1).Value
Target.Offset(, 2) = rPart.Offset(, 1)
Set Target = Target.Offset(1)
Set rPart = rPart.Offset(1)
Loop
' Enters the Grand Total Price
Target.Offset(, 0) = "Term Model Price"
Target.Offset(, 2) = Worksheets("Source
Code").Range("TermModel.Price")
Set Target = Target.Offset(1)
Set rPart = rPart.Offset(1)
' Enters the SW tools
Target.Offset(, 0) = "SW Tools"
Target.Offset(, 2) = Worksheets("SW Tools").Range("B14")
'Application.DisplayAlerts = False
'ws.Delete
'Application.DisplayAlerts = True
'Set rPart = Worksheets("Source Code").Range("B17")
' Start Word Doc
' ws.Activate
' DumptoWord1
End Sub
:
First off, you are putting the value 10 into the cell *first* and then
telling Excel to make that into a percentage... 10, as a percentage is
1000%. If your users will be typing in the actual percentage number,
then
you will need to divide it by 100 to make it a correct value. You will
have
to build the appropriate controlling code around this, but here is how
to
ask for the percentage, insert it into the cell and then color the
cell
yellow...
Range("H1").Value = InputBox("What percentage") / 100
Range("H1").NumberFormat = "0.00%"
Range("H1").Interior.ColorIndex = 6
--
Rick (MVP - Excel)
Hi Rick, thank you for helping :> I would like to format the cell
[H1]
so
that it's yellow with a percentage in it that can be multiplied by
the
values
in the rest of the worksheet
so for example
Input box asks what the discount is: They type in 10, but for some
reason
it's then returning 1000% and I am hoping it'll place a 10% in there
and
the
background show up in Yellow
:
Explain what you are looking for when you say "highlighting the
cell"...
exactly what do you have in mind here?
--
Rick (MVP - Excel)
currently I only know how to get it to be in discount form? I
don't
know
how
to add to the format to include highlighting the cell?
:
Selecting the cell doesn't "highlight" it enough for you? If
not,
then
you
need to tell us what or how your want the highlight to look. As
for
asking
the user for the discount amount, you can use an InputBox. For
example,
perhaps like this...
..Range("H1").Value = InputBox("Discount amount?")
--
Rick (MVP - Excel)
is there a way to highlight this cell as well and ask the user
for
how
much
they would like to discount?
' Formats the Discount Percentage
.Range("H1").Select
Selection.NumberFormat = "0.00%"
Thank you!