ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   macros (https://www.excelbanter.com/new-users-excel/168416-macros.html)

neilb514

macros
 
hi
I have been running the following macro and it works fine except i have to
push button 6 twice to get it to recalculate and display the correct number
in cell c14. can anyone tell me why and how to fix this annoyance.

Sub Button6_Click()

Range("c12") = Range("c12") + Range("d8")
If IsNumeric(Range("F2").Value) Then
Select Case Range("F2").Value
Case Is <= 1
myvalue = 1
Case Is <= 2
myvalue = 2
Case Is <= 3
myvalue = 3
Case Is <= 4
myvalue = 4
Case Else
myvalue = 5
End Select
Range("C14").Value = myvalue

End If


Range("c18") = Range("c18") + Range("d7")

Range("A8,b8,b7,c8") = 0


End Sub

Mike H

macros
 
Hi,

C14 is derived from the value in F2 and If it isn't displaying correctly
first time then I doubt if this macro causing it.

P.S. I'm glad that in other respects it's working, thanks for the feedback!

Mike

"neilb514" wrote:

hi
I have been running the following macro and it works fine except i have to
push button 6 twice to get it to recalculate and display the correct number
in cell c14. can anyone tell me why and how to fix this annoyance.

Sub Button6_Click()

Range("c12") = Range("c12") + Range("d8")
If IsNumeric(Range("F2").Value) Then
Select Case Range("F2").Value
Case Is <= 1
myvalue = 1
Case Is <= 2
myvalue = 2
Case Is <= 3
myvalue = 3
Case Is <= 4
myvalue = 4
Case Else
myvalue = 5
End Select
Range("C14").Value = myvalue

End If


Range("c18") = Range("c18") + Range("d7")

Range("A8,b8,b7,c8") = 0


End Sub


Don Guillett

macros
 
Didn't like mine, huh?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"neilb514" wrote in message
...
hi
I have been running the following macro and it works fine except i have to
push button 6 twice to get it to recalculate and display the correct
number
in cell c14. can anyone tell me why and how to fix this annoyance.

Sub Button6_Click()

Range("c12") = Range("c12") + Range("d8")
If IsNumeric(Range("F2").Value) Then
Select Case Range("F2").Value
Case Is <= 1
myvalue = 1
Case Is <= 2
myvalue = 2
Case Is <= 3
myvalue = 3
Case Is <= 4
myvalue = 4
Case Else
myvalue = 5
End Select
Range("C14").Value = myvalue

End If


Range("c18") = Range("c18") + Range("d7")

Range("A8,b8,b7,c8") = 0


End Sub




All times are GMT +1. The time now is 08:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com