Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Inserting a Value into a Range

I wrote the following code and i cant get the end result in the cell G37 & G38.

So if you anyone can see what i did wrong it would be really great.

Andy

Private Sub Tax()
Dim StateTax As Range
Dim CountyTax As Range
Dim VM As Range
Dim OP As Range
Dim VC As Variant
Dim VS As Variant
Dim OC As Variant
Dim OS As Variant
Dim TST As Variant
Dim TCT As Variant


Set StateTax = Worksheets("BID RECAP SUMMARY").Range("E37")
Set CoutyTax = Worksheets("BID RECAP SUMMARY").Range("E38")
Set VM = Worksheets("BID RECAP SUMMARY").Range("I18")
Set OP = Worksheets("BID RECAP SUMMARY").Range("I33")

Select Case CheckBox40.Value
Case Is = True
VS = StateTax * VM
VC = CountyTax * VM
Case Is = False
VS = 0
VC = 0
End Select

Select Case CheckBox38.Value
Case Is = True
OS = StateTax * OP
OC = CountyTax * OP
Case Is = False
OS = 0
OC = 0
End Select

TST = VS + OS
TCT = VC + OC

Worksheets("BID RECAP SUMMARY").Range("g37").Value = TST
Worksheets("BID RECAP SUMMARY").Range("g38").Value = TCT

END SUB
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Inserting a Value into a Range

you could try:

Worksheets("BID RECAP SUMMARY").Range("g37").FormulaR1C1 = TST
Worksheets("BID RECAP SUMMARY").Range("g38").FormulaR1C1 = TCT

"Andy" wrote:

I wrote the following code and i cant get the end result in the cell G37 & G38.

So if you anyone can see what i did wrong it would be really great.

Andy

Private Sub Tax()
Dim StateTax As Range
Dim CountyTax As Range
Dim VM As Range
Dim OP As Range
Dim VC As Variant
Dim VS As Variant
Dim OC As Variant
Dim OS As Variant
Dim TST As Variant
Dim TCT As Variant


Set StateTax = Worksheets("BID RECAP SUMMARY").Range("E37")
Set CoutyTax = Worksheets("BID RECAP SUMMARY").Range("E38")
Set VM = Worksheets("BID RECAP SUMMARY").Range("I18")
Set OP = Worksheets("BID RECAP SUMMARY").Range("I33")

Select Case CheckBox40.Value
Case Is = True
VS = StateTax * VM
VC = CountyTax * VM
Case Is = False
VS = 0
VC = 0
End Select

Select Case CheckBox38.Value
Case Is = True
OS = StateTax * OP
OC = CountyTax * OP
Case Is = False
OS = 0
OC = 0
End Select

TST = VS + OS
TCT = VC + OC

Worksheets("BID RECAP SUMMARY").Range("g37").Value = TST
Worksheets("BID RECAP SUMMARY").Range("g38").Value = TCT

END SUB

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Inserting a Value into a Range

Hi Andy,
Do you use Option Explicit with your code modules?
Is the code you have posted a copy/paste of the original code or have
you entered it via the keyboard?
You have "Dim CountyTax As Range" and "Set CoutyTax = ....."
Option Explicit would pick up this typo when you run the code.
I can't be certain, but that could be the problem.
Ken Johnson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Inserting a Value into a Range

I inserted the "option explicit"

now it brings up that the checkbox40 has not been defined. So i am confused,
how do i define the value of a checkbox as a variable?

"Ken Johnson" wrote:

Hi Andy,
Do you use Option Explicit with your code modules?
Is the code you have posted a copy/paste of the original code or have
you entered it via the keyboard?
You have "Dim CountyTax As Range" and "Set CoutyTax = ....."
Option Explicit would pick up this typo when you run the code.
I can't be certain, but that could be the problem.
Ken Johnson


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting a range of cells Shazzer Excel Worksheet Functions 1 July 4th 07 06:53 PM
Inserting Excel Range into Word cmurphy Excel Programming 2 July 11th 05 07:30 PM
Inserting data within a named range..HELP sulrich Excel Programming 2 February 18th 05 06:16 PM
VBA: copying and inserting a dynamic range JP[_10_] Excel Programming 2 June 1st 04 10:29 PM
Inserting value at end of range Todd Huttenstine[_2_] Excel Programming 9 November 30th 03 01:19 AM


All times are GMT +1. The time now is 07:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"