Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro code to paste objects...! 3

Status
Not open for further replies.

Dumboy

Technical User
Feb 29, 2000
97
US
How would I create a macro that if the value of the cell is positive will paste an object (shape) and if it is negative a different object (shape)<br><br>I guess what I'm looking for is a VBasic statement for if value in this range then ...<br><br>anybody can give me the basics.... <p>Dumboy.! Ouch.! .my brain.....<br><a href=mailto:spiderdesign@yahoo.com>spiderdesign@yahoo.com</a><br><a href= > </a><br>It's hard to think with only one neuron......Ouch.....!....it hurts when I think......!
 
How about something like this?&nbsp;&nbsp;I am assuming that you are talking about Excel.<br><br><br>*****************<br><br>'dim a variable for each cell<br>dim c as range<br>'dim a variable for the range to work with<br>dim rngSearch as range<br><br>set rngSearch = YOURRANGE<br><br>for each c in rngSearch<br>&nbsp;&nbsp;&nbsp;if c.value&gt;0 then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c.value = ONE OBJECT<br>&nbsp;&nbsp;&nbsp;elseif c.value&lt;0 then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c.value = THE OTHER OBJECT<br>&nbsp;&nbsp;&nbsp;end if<br>next c<br><br>***********<br><br>??&nbsp;&nbsp;What if the value is exactly zero?
 
Kathryn... Thanks.... I think that surely will work....<br><br> <p>Dumboy.! Ouch.! .my brain.....<br><a href=mailto:spiderdesign@yahoo.com>spiderdesign@yahoo.com</a><br><a href= > </a><br>It's hard to think with only one neuron......Ouch.....!....it hurts when I think......!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top