Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Shed some light on this WS_Calculate macro.

The * in the If statement is confusing me, is it the same as And, OR, or Either as it relates to the rngC.Value

What exact does the If statement say?

In my test to try to understand the statement I kept getting Type mismatch errors. Using A1 and B1 then pulling down to produce a small data set to apply the code to, and using = or < "xx" instead of 99. Using numbers only seems to prevent that.

The col 46 = col 49 I understand.

Thanks.
Howard

Private Sub Worksheet_Calculate()
Dim LRow As Long
Dim rngC As Range

LRow = Cells(Rows.Count, 61).End(xlUp).Row
For Each rngC In Range("BI1:BI" & LRow)
If rngC.Value * rngC.Offset(, 1).Value = 99 Then
Cells(rngC.Row, 46) = Cells(rngC.Row, 49)
End If
Next
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Shed some light on this WS_Calculate macro.

Hi Howard,

Am Sat, 18 Jan 2014 22:06:35 -0800 (PST) schrieb L. Howard:

If rngC.Value * rngC.Offset(, 1).Value = 99 Then


both cells rngC and rngC.Offset(,1) should be NOT zero to change the
cell value in column 46.
IF you multiply to values and one of them is 0 the result = 0
So it is the same as writing
IF rngc < 0 or rngc.offset(,1) < 0
The muliplication is the substitute for the OR statement above


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Shed some light on this WS_Calculate macro.

Hi Howard,

Am Sun, 19 Jan 2014 08:34:11 +0100 schrieb Claus Busch:

sorry, typo

IF you multiply to values and one of them is 0 the result = 0

^^^^
if you multiply two values and one of them is 0 the result is 0


Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Shed some light on this WS_Calculate macro.

On Saturday, January 18, 2014 11:34:11 PM UTC-8, Claus Busch wrote:
Hi Howard,



Am Sat, 18 Jan 2014 22:06:35 -0800 (PST) schrieb L. Howard:



If rngC.Value * rngC.Offset(, 1).Value = 99 Then




both cells rngC and rngC.Offset(,1) should be NOT zero to change the

cell value in column 46.

IF you multiply to values and one of them is 0 the result = 0

So it is the same as writing

IF rngc < 0 or rngc.offset(,1) < 0

The muliplication is the substitute for the OR statement above





Regards

Claus B.


Okay thanks. That would be the reason for the type mismatch, trying to multiply text.

Appreciate it.

Howard
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
Excel 2007 noncontiguous cell highlight color=light,light blue. How do I make it darker, or like Excel 2003 ( I'm extremely shade blind-PLZ HELP !! ) DCJM Excel Discussion (Misc queries) 1 July 27th 11 10:42 PM
Code jumps to WS_Calculate on a different sheet JMay Excel Programming 5 June 3rd 09 06:27 PM
How to replace the background color of all cells from light green to light blue? Claudia d'Amato Excel Programming 5 November 15th 08 12:11 AM
How to replace the background color of all cells from light green to light blue? Claudia d'Amato Excel Discussion (Misc queries) 1 November 14th 08 07:09 PM
Macro help (not the sharpest tool in the shed) Dano Excel Programming 1 September 13th 08 12:13 AM


All times are GMT +1. The time now is 01:59 AM.

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"