Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to write code for a paste special if statement and need help. I
want it to perform like this: If C1 (calculated from other formula) is equal to 1, then paste that value into D1, if it is equal to 0, then do nothing. I'm trying to get a column that identifies which items in the first column were ever calculated to equal one and then apply conditional formatting. Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Put the following worksheet event macro in the worksheet code area:
Private Sub Worksheet_Calculate() If Range("C1").Value = 1 Then Range("D1").Value = 1 End If End Sub Because it is worksheet code, it is very easy to install and use: 1. right-click the tab name near the bottom of the window 2. select View Code - this brings up a VBE window 3. paste the stuff in and close the VBE window If you save the workbook, the macro will be saved with it. To remove the macro: 1. bring up the VBE windows as above 2. clear the code out 3. close the VBE window To learn more about Event Macros (worksheet code), see: http://www.mvps.org/dmcritchie/excel/event.htm -- Gary''s Student - gsnu200902 "Jeremy" wrote: I'm trying to write code for a paste special if statement and need help. I want it to perform like this: If C1 (calculated from other formula) is equal to 1, then paste that value into D1, if it is equal to 0, then do nothing. I'm trying to get a column that identifies which items in the first column were ever calculated to equal one and then apply conditional formatting. Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yea, I had tried that before and it didn't work, still can't seem to.
I have pasted the code, put a 1 in the cell C1, I saved the book, hit F9 to calculate etc and nothing. "Gary''s Student" wrote: Put the following worksheet event macro in the worksheet code area: Private Sub Worksheet_Calculate() If Range("C1").Value = 1 Then Range("D1").Value = 1 End If End Sub Because it is worksheet code, it is very easy to install and use: 1. right-click the tab name near the bottom of the window 2. select View Code - this brings up a VBE window 3. paste the stuff in and close the VBE window If you save the workbook, the macro will be saved with it. To remove the macro: 1. bring up the VBE windows as above 2. clear the code out 3. close the VBE window To learn more about Event Macros (worksheet code), see: http://www.mvps.org/dmcritchie/excel/event.htm -- Gary''s Student - gsnu200902 "Jeremy" wrote: I'm trying to write code for a paste special if statement and need help. I want it to perform like this: If C1 (calculated from other formula) is equal to 1, then paste that value into D1, if it is equal to 0, then do nothing. I'm trying to get a column that identifies which items in the first column were ever calculated to equal one and then apply conditional formatting. Thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nevermind, I got it. I think there was an old definition or something in
there. I deleted the cells instead of just clearing and it worked fine. Thanks! "Gary''s Student" wrote: Put the following worksheet event macro in the worksheet code area: Private Sub Worksheet_Calculate() If Range("C1").Value = 1 Then Range("D1").Value = 1 End If End Sub Because it is worksheet code, it is very easy to install and use: 1. right-click the tab name near the bottom of the window 2. select View Code - this brings up a VBE window 3. paste the stuff in and close the VBE window If you save the workbook, the macro will be saved with it. To remove the macro: 1. bring up the VBE windows as above 2. clear the code out 3. close the VBE window To learn more about Event Macros (worksheet code), see: http://www.mvps.org/dmcritchie/excel/event.htm -- Gary''s Student - gsnu200902 "Jeremy" wrote: I'm trying to write code for a paste special if statement and need help. I want it to perform like this: If C1 (calculated from other formula) is equal to 1, then paste that value into D1, if it is equal to 0, then do nothing. I'm trying to get a column that identifies which items in the first column were ever calculated to equal one and then apply conditional formatting. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Special Copy, Paste Special macro | Excel Programming | |||
Automating copy/paste/paste special when row references change | Excel Programming | |||
Paste Special If Statement | Excel Programming | |||
In Excel: add a Paste-Special Option to paste IN REVERSE ORDER. | Excel Worksheet Functions | |||
Dynamic Copy/Paste Special Formulas/Paste Special Values | Excel Programming |