Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Prevent range reference

Hi,

I'm using below code in regular excel (not vba). When I run my macro the
cell reference jumps automatically to the adjacent column (H becomes I and G
becomes H). Is there any way to prevent this?! Either by code or by options?!

=SUMPRODUCT(('Source Data'!$H$1:$H$5000=A96)*('Source
Data'!$G$1:$G$5000=$B$94))

Regards,

Basta
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,722
Default Prevent range reference

Could use an INDIRECT reference to make it completely static...

=SUMPRODUCT((INDIRECT("'Source Data'!H1:H5000")=A96)*
(INDIRECT("'Source Data'!G1:G5000")=$B$94))

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Basta1980" wrote:

Hi,

I'm using below code in regular excel (not vba). When I run my macro the
cell reference jumps automatically to the adjacent column (H becomes I and G
becomes H). Is there any way to prevent this?! Either by code or by options?!

=SUMPRODUCT(('Source Data'!$H$1:$H$5000=A96)*('Source
Data'!$G$1:$G$5000=$B$94))

Regards,

Basta

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Prevent range reference

so your code inserts a colum?
Use OFFSET

so something like

=SUMPRODUCT( (OFFSET('Source data'!A1:A5000,0,7)=A96) ....
the idea is set the ref to a column at teh same row, then offset it by 7
columns
it will always be 7 columns, irrespective of what you insert to that sheet,
so long as you don't insert a column 1




"Basta1980" wrote:

Hi,

I'm using below code in regular excel (not vba). When I run my macro the
cell reference jumps automatically to the adjacent column (H becomes I and G
becomes H). Is there any way to prevent this?! Either by code or by options?!

=SUMPRODUCT(('Source Data'!$H$1:$H$5000=A96)*('Source
Data'!$G$1:$G$5000=$B$94))

Regards,

Basta

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Prevent range reference

Patrick & Luke,

Thnx

"Patrick Molloy" wrote:

so your code inserts a colum?
Use OFFSET

so something like

=SUMPRODUCT( (OFFSET('Source data'!A1:A5000,0,7)=A96) ....
the idea is set the ref to a column at teh same row, then offset it by 7
columns
it will always be 7 columns, irrespective of what you insert to that sheet,
so long as you don't insert a column 1




"Basta1980" wrote:

Hi,

I'm using below code in regular excel (not vba). When I run my macro the
cell reference jumps automatically to the adjacent column (H becomes I and G
becomes H). Is there any way to prevent this?! Either by code or by options?!

=SUMPRODUCT(('Source Data'!$H$1:$H$5000=A96)*('Source
Data'!$G$1:$G$5000=$B$94))

Regards,

Basta

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
Prevent List Box Reference from Changing when workbook closes? dim Excel Discussion (Misc queries) 3 April 28th 08 01:29 AM
Prevent cut and paste over a range andy62 Excel Worksheet Functions 0 June 30th 07 04:22 AM
Prevent formula reference from changing ScottyC Excel Discussion (Misc queries) 3 February 9th 07 03:06 AM
Excel - how to prevent new office version from upgrading word object reference Zoner Excel Programming 3 July 5th 06 07:04 PM
prevent row insert in a range of rows pcorbani Excel Programming 1 March 8th 06 02:01 PM


All times are GMT +1. The time now is 04:07 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"