Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've created a button linked to several calculations. It begins by
calculating a percentage. Then I figure the dollars with that figure. Then I figure the difference between the original dollar amt and the new dollar amt. Then I copy this into the cells I want it to stay. I have 4 buttons I'm using to cover 4 possible scenarios. They're all set at "Percent - Dollar - Dollar" (and they're all set up to run via macro tied to the buttons. Now, on some, when I click the button it's changing my first dollar to a percent. Why would it do that and how can I prevent it? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Difficult to determine without seeing the code; can you post it please.
"Debbie" wrote: I've created a button linked to several calculations. It begins by calculating a percentage. Then I figure the dollars with that figure. Then I figure the difference between the original dollar amt and the new dollar amt. Then I copy this into the cells I want it to stay. I have 4 buttons I'm using to cover 4 possible scenarios. They're all set at "Percent - Dollar - Dollar" (and they're all set up to run via macro tied to the buttons. Now, on some, when I click the button it's changing my first dollar to a percent. Why would it do that and how can I prevent it? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have 3 buttons I've built using Macro's to initiate the actions.
Button 1 and Button 2 work perfectly. Button 3 changes my first number from a $figure to a percentage. It's weird. I have one thought on why. The sheet has been passed back and forth between windows and Mac. Maybe it lost something in there. Private Sub CommandButton1_Click() ' ' Calc1 Macro ' Macro recorded 4/17/2006 by DBagby ' ' ActiveCell.FormulaR1C1 = "=R7C[5]*R[-93]C[4]" Range("O103").Select ActiveCell.FormulaR1C1 = "=R7C[5]*R[-93]C[4]" Range("O104").Select ActiveCell.FormulaR1C1 = "=R7C[5]*R[-93]C[4]" Range("P102").Select ActiveCell.FormulaR1C1 = "=R[-93]C[1]-RC[-1]" Range("P103").Select ActiveCell.FormulaR1C1 = "=R[-93]C[1]-RC[-1]" Range("P104").Select ActiveCell.FormulaR1C1 = "=R[-93]C[1]-RC[-1]" Range("O102:P104").Select Selection.Copy Range("T9").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False End Sub Private Sub CommandButton2_Click() ' ' Calc2 Macro ' Macro recorded 4/17/2006 by DBagby ' ' ActiveCell.FormulaR1C1 = "=R[-93]C/(R12C-R11C)" Range("Q103").Select ActiveCell.FormulaR1C1 = "=R[-93]C/(R12C-R11C)" Range("Q104").Select ActiveCell.FormulaR1C1 = "0%" Range("R102").Select ActiveCell.FormulaR1C1 = "=R7C[2]*RC[-1]" Range("R103").Select ActiveCell.FormulaR1C1 = "=R7C[2]*RC[-1]" Range("R104").Select ActiveCell.FormulaR1C1 = "=R7C[2]*RC[-1]" Range("S102").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-2]-RC[-1]" Range("S103").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-2]-RC[-1]" Range("S104").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-2]-RC[-1]" Range("R102:S104").Select Selection.Copy Range("T9").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False End Sub Private Sub CommandButton3_Click() ' ' Calc3 Macro ' Macro recorded 4/17/2006 by DBagby ' ' ActiveCell.FormulaR1C1 = "0%" Range("T103").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-3]/(R12C[-3]-R9C[-3])" Range("T104").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-3]/(R12C[-3]-R9C[-3])" Range("U102").Select ActiveCell.FormulaR1C1 = "=R7C[-1]*RC[-1]" Range("U103").Select ActiveCell.FormulaR1C1 = "=R7C[-1]*RC[-1]" Range("U104").Select ActiveCell.FormulaR1C1 = "=-R[-97]C[-1]" Range("U104").Select ActiveCell.FormulaR1C1 = "=R7C[-1]*RC[-1]" Range("V102").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-5]-RC[-1]" Range("V103").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-5]-RC[-1]" Range("V104").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-5]-RC[-1]" Range("U102:V104").Select Selection.Copy Range("T9").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False Range("T12").Select End Sub "Toppers" wrote: Difficult to determine without seeing the code; can you post it please. "Debbie" wrote: I've created a button linked to several calculations. It begins by calculating a percentage. Then I figure the dollars with that figure. Then I figure the difference between the original dollar amt and the new dollar amt. Then I copy this into the cells I want it to stay. I have 4 buttons I'm using to cover 4 possible scenarios. They're all set at "Percent - Dollar - Dollar" (and they're all set up to run via macro tied to the buttons. Now, on some, when I click the button it's changing my first dollar to a percent. Why would it do that and how can I prevent it? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your 3rd macro set the Activecell to % so if this (active) cell contains your
$ data it will be set to %. However, in my testing if I set the Activecell format to currency it didn't get changed but did if the format was GENERAL. You could remove the SELECT statements and see if this makes any dfference: Range("T103")..FormulaR1C1 = "=R[-93]C[-3]/(R12C[-3]-R9C[-3])" from Range("T103").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-3]/(R12C[-3]-R9C[-3])" hth "Debbie" wrote: I have 3 buttons I've built using Macro's to initiate the actions. Button 1 and Button 2 work perfectly. Button 3 changes my first number from a $figure to a percentage. It's weird. I have one thought on why. The sheet has been passed back and forth between windows and Mac. Maybe it lost something in there. Private Sub CommandButton1_Click() ' ' Calc1 Macro ' Macro recorded 4/17/2006 by DBagby ' ' ActiveCell.FormulaR1C1 = "=R7C[5]*R[-93]C[4]" Range("O103").Select ActiveCell.FormulaR1C1 = "=R7C[5]*R[-93]C[4]" Range("O104").Select ActiveCell.FormulaR1C1 = "=R7C[5]*R[-93]C[4]" Range("P102").Select ActiveCell.FormulaR1C1 = "=R[-93]C[1]-RC[-1]" Range("P103").Select ActiveCell.FormulaR1C1 = "=R[-93]C[1]-RC[-1]" Range("P104").Select ActiveCell.FormulaR1C1 = "=R[-93]C[1]-RC[-1]" Range("O102:P104").Select Selection.Copy Range("T9").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False End Sub Private Sub CommandButton2_Click() ' ' Calc2 Macro ' Macro recorded 4/17/2006 by DBagby ' ' ActiveCell.FormulaR1C1 = "=R[-93]C/(R12C-R11C)" Range("Q103").Select ActiveCell.FormulaR1C1 = "=R[-93]C/(R12C-R11C)" Range("Q104").Select ActiveCell.FormulaR1C1 = "0%" Range("R102").Select ActiveCell.FormulaR1C1 = "=R7C[2]*RC[-1]" Range("R103").Select ActiveCell.FormulaR1C1 = "=R7C[2]*RC[-1]" Range("R104").Select ActiveCell.FormulaR1C1 = "=R7C[2]*RC[-1]" Range("S102").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-2]-RC[-1]" Range("S103").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-2]-RC[-1]" Range("S104").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-2]-RC[-1]" Range("R102:S104").Select Selection.Copy Range("T9").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False End Sub Private Sub CommandButton3_Click() ' ' Calc3 Macro ' Macro recorded 4/17/2006 by DBagby ' ' ActiveCell.FormulaR1C1 = "0%" Range("T103").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-3]/(R12C[-3]-R9C[-3])" Range("T104").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-3]/(R12C[-3]-R9C[-3])" Range("U102").Select ActiveCell.FormulaR1C1 = "=R7C[-1]*RC[-1]" Range("U103").Select ActiveCell.FormulaR1C1 = "=R7C[-1]*RC[-1]" Range("U104").Select ActiveCell.FormulaR1C1 = "=-R[-97]C[-1]" Range("U104").Select ActiveCell.FormulaR1C1 = "=R7C[-1]*RC[-1]" Range("V102").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-5]-RC[-1]" Range("V103").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-5]-RC[-1]" Range("V104").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-5]-RC[-1]" Range("U102:V104").Select Selection.Copy Range("T9").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False Range("T12").Select End Sub "Toppers" wrote: Difficult to determine without seeing the code; can you post it please. "Debbie" wrote: I've created a button linked to several calculations. It begins by calculating a percentage. Then I figure the dollars with that figure. Then I figure the difference between the original dollar amt and the new dollar amt. Then I copy this into the cells I want it to stay. I have 4 buttons I'm using to cover 4 possible scenarios. They're all set at "Percent - Dollar - Dollar" (and they're all set up to run via macro tied to the buttons. Now, on some, when I click the button it's changing my first dollar to a percent. Why would it do that and how can I prevent it? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for your help.
It's up and running. I have one more question if you would be so kind. Otherwise, I can post as a new thread. When I "password protect" my worksheet, my buttons no longer work. I get a run-time error 1004. Any ideas why it would do this? "Toppers" wrote: Your 3rd macro set the Activecell to % so if this (active) cell contains your $ data it will be set to %. However, in my testing if I set the Activecell format to currency it didn't get changed but did if the format was GENERAL. You could remove the SELECT statements and see if this makes any dfference: Range("T103")..FormulaR1C1 = "=R[-93]C[-3]/(R12C[-3]-R9C[-3])" from Range("T103").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-3]/(R12C[-3]-R9C[-3])" hth "Debbie" wrote: I have 3 buttons I've built using Macro's to initiate the actions. Button 1 and Button 2 work perfectly. Button 3 changes my first number from a $figure to a percentage. It's weird. I have one thought on why. The sheet has been passed back and forth between windows and Mac. Maybe it lost something in there. Private Sub CommandButton1_Click() ' ' Calc1 Macro ' Macro recorded 4/17/2006 by DBagby ' ' ActiveCell.FormulaR1C1 = "=R7C[5]*R[-93]C[4]" Range("O103").Select ActiveCell.FormulaR1C1 = "=R7C[5]*R[-93]C[4]" Range("O104").Select ActiveCell.FormulaR1C1 = "=R7C[5]*R[-93]C[4]" Range("P102").Select ActiveCell.FormulaR1C1 = "=R[-93]C[1]-RC[-1]" Range("P103").Select ActiveCell.FormulaR1C1 = "=R[-93]C[1]-RC[-1]" Range("P104").Select ActiveCell.FormulaR1C1 = "=R[-93]C[1]-RC[-1]" Range("O102:P104").Select Selection.Copy Range("T9").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False End Sub Private Sub CommandButton2_Click() ' ' Calc2 Macro ' Macro recorded 4/17/2006 by DBagby ' ' ActiveCell.FormulaR1C1 = "=R[-93]C/(R12C-R11C)" Range("Q103").Select ActiveCell.FormulaR1C1 = "=R[-93]C/(R12C-R11C)" Range("Q104").Select ActiveCell.FormulaR1C1 = "0%" Range("R102").Select ActiveCell.FormulaR1C1 = "=R7C[2]*RC[-1]" Range("R103").Select ActiveCell.FormulaR1C1 = "=R7C[2]*RC[-1]" Range("R104").Select ActiveCell.FormulaR1C1 = "=R7C[2]*RC[-1]" Range("S102").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-2]-RC[-1]" Range("S103").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-2]-RC[-1]" Range("S104").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-2]-RC[-1]" Range("R102:S104").Select Selection.Copy Range("T9").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False End Sub Private Sub CommandButton3_Click() ' ' Calc3 Macro ' Macro recorded 4/17/2006 by DBagby ' ' ActiveCell.FormulaR1C1 = "0%" Range("T103").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-3]/(R12C[-3]-R9C[-3])" Range("T104").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-3]/(R12C[-3]-R9C[-3])" Range("U102").Select ActiveCell.FormulaR1C1 = "=R7C[-1]*RC[-1]" Range("U103").Select ActiveCell.FormulaR1C1 = "=R7C[-1]*RC[-1]" Range("U104").Select ActiveCell.FormulaR1C1 = "=-R[-97]C[-1]" Range("U104").Select ActiveCell.FormulaR1C1 = "=R7C[-1]*RC[-1]" Range("V102").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-5]-RC[-1]" Range("V103").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-5]-RC[-1]" Range("V104").Select ActiveCell.FormulaR1C1 = "=R[-93]C[-5]-RC[-1]" Range("U102:V104").Select Selection.Copy Range("T9").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False Range("T12").Select End Sub "Toppers" wrote: Difficult to determine without seeing the code; can you post it please. "Debbie" wrote: I've created a button linked to several calculations. It begins by calculating a percentage. Then I figure the dollars with that figure. Then I figure the difference between the original dollar amt and the new dollar amt. Then I copy this into the cells I want it to stay. I have 4 buttons I'm using to cover 4 possible scenarios. They're all set at "Percent - Dollar - Dollar" (and they're all set up to run via macro tied to the buttons. Now, on some, when I click the button it's changing my first dollar to a percent. Why would it do that and how can I prevent it? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Lock Cell Format - Allow copy and paste of data without format change | Excel Worksheet Functions | |||
Can you lock the format of a cell and still change content | Excel Worksheet Functions | |||
Lock cell formats (conditional format) | Excel Worksheet Functions | |||
Conditional Format To Lock Cell | Excel Discussion (Misc queries) | |||
Is there a way to lock out the format for the cell and still allow data entry and C&P? | New Users to Excel |