ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   IF Activecell (https://www.excelbanter.com/excel-programming/375391-if-activecell.html)

Rewop Eilsel[_2_]

IF Activecell
 
I have a global matrix, 36 columns x 24 rows, made up of 6 €“ 12 x 12 sub
matrices.
I want to write a macro that will determine which 12 x 12 RANGE contains the
ACTIVECELL and then REPLACE a specific value in that sub matrix.

I have tried to write nested IF statements e.g.
IF(Activecell()<(€œM13€),Range(€œA1:L12€),IF (Activecell()<(€œY13€)€¦etc
But each variation I make still fails with syntax or compile errors.
Can anyone please help

Rewop Eilsel


WhytheQ

IF Activecell
 
Does Activecell usually have brackets after it?

On Oct 18, 2:15 pm, Rewop Eilsel
wrote:
I have a global matrix, 36 columns x 24 rows, made up of 6 - 12 x 12 sub
matrices.
I want to write a macro that will determine which 12 x 12 RANGE contains the
ACTIVECELL and then REPLACE a specific value in that sub matrix.

I have tried to write nested IF statements e.g.
IF(Activecell()<("M13"),Range("A1:L12"),IF(Activec ell()<("Y13")...etc
But each variation I make still fails with syntax or compile errors.
Can anyone please help

Rewop Eilsel



Bob Phillips

IF Activecell
 
If Not Intersect(ActiveCell, Range("Matrix1")) Is Nothing Then
MsgBox "Matrix 1"
ElseIf Not Intersect(ActiveCell, Range("Matrix2")) Is Nothing Then
MsgBox "Matrix 2"
ElseIf Not Intersect(ActiveCell, Range("Matrix3")) Is Nothing Then
MsgBox "Matrix 3"
ElseIf Not Intersect(ActiveCell, Range("Matrix4")) Is Nothing Then
MsgBox "Matrix 4"
ElseIf Not Intersect(ActiveCell, Range("Matrix5")) Is Nothing Then
MsgBox "Matrix 5"
ElseIf Not Intersect(ActiveCell, Range("Matrix16")) Is Nothing Then
MsgBox "Matrix 6"
'etc.
End If

What happens if it is in more than one?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Rewop Eilsel" wrote in message
...
I have a global matrix, 36 columns x 24 rows, made up of 6 - 12 x 12 sub
matrices.
I want to write a macro that will determine which 12 x 12 RANGE contains

the
ACTIVECELL and then REPLACE a specific value in that sub matrix.

I have tried to write nested IF statements e.g.
IF(Activecell()<("M13"),Range("A1:L12"),IF(Activec ell()<("Y13").etc
But each variation I make still fails with syntax or compile errors.
Can anyone please help

Rewop Eilsel





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

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