Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mo2 Mo2 is offline
external usenet poster
 
Posts: 34
Default need macro to edit formula...

this is difficult to explain, but here goes nothing...

here's my sample formula, in Cell G25:
=IF(D25=0,0,IF(D45=0,0,B45))

This is what i want the macro to do:
Step1: read the number in cell A1. (lets say i type "2" in there)

Step2: Add "2" to every cell reference in G25's formula, except the
reference that refers to the current cell's row (in this case, row 25).

I.E. this would change G25's formula from: =IF(D25=0,0,IF(D47=0,0,B47))
to:
=IF(D25=0,0,IF(D47=0,0,B47))

STEP3: copy the new formula down for 20 rows.

I need this same thing to happen, if i type a number in A2
(except this time, it would be looking at the formula in I25
and following the same steps.
I25's formula is : =IF(D25=0,0,IF(D44=0,0,B44))


can anybody help me please?
if this can be done through some sort of pop up (which startup as soon as i
open the worksheet), instead of typing a number in a cell, even better. but
either way will work for me:)

thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default need macro to edit formula...

If I understand it correctly, I think this should work (or at least give you
some idea to do what you're trying to accomplish). Try putting this formula
in G25:

=IF(D25=0,0,IF(INDIRECT("D" & 45+$A$1)=0,0,INDIRECT("B" & 45+$A$1)))

then copy down as needed. The row number of the cell references will always
be 45 plus whatever number is in A1. If you need the row number to increment
as you copy down, try it this way:

=IF(D25=0,0,IF(INDIRECT("D" & ROW()+20+$A$1)=0,0,INDIRECT("B" &
ROW()+20+$A$1)))

then copy down as needed.

--
Hope that helps.

Vergel Adriano


"Mo2" wrote:

this is difficult to explain, but here goes nothing...

here's my sample formula, in Cell G25:
=IF(D25=0,0,IF(D45=0,0,B45))

This is what i want the macro to do:
Step1: read the number in cell A1. (lets say i type "2" in there)

Step2: Add "2" to every cell reference in G25's formula, except the
reference that refers to the current cell's row (in this case, row 25).

I.E. this would change G25's formula from: =IF(D25=0,0,IF(D47=0,0,B47))
to:
=IF(D25=0,0,IF(D47=0,0,B47))

STEP3: copy the new formula down for 20 rows.

I need this same thing to happen, if i type a number in A2
(except this time, it would be looking at the formula in I25
and following the same steps.
I25's formula is : =IF(D25=0,0,IF(D44=0,0,B44))


can anybody help me please?
if this can be done through some sort of pop up (which startup as soon as i
open the worksheet), instead of typing a number in a cell, even better. but
either way will work for me:)

thanks in advance

  #3   Report Post  
Posted to microsoft.public.excel.programming
Mo2 Mo2 is offline
external usenet poster
 
Posts: 34
Default need macro to edit formula...

nice! thank you it works

i'll let you know if i have any more problems:)

thanks again




"Vergel Adriano" wrote:

If I understand it correctly, I think this should work (or at least give you
some idea to do what you're trying to accomplish). Try putting this formula
in G25:

=IF(D25=0,0,IF(INDIRECT("D" & 45+$A$1)=0,0,INDIRECT("B" & 45+$A$1)))

then copy down as needed. The row number of the cell references will always
be 45 plus whatever number is in A1. If you need the row number to increment
as you copy down, try it this way:

=IF(D25=0,0,IF(INDIRECT("D" & ROW()+20+$A$1)=0,0,INDIRECT("B" &
ROW()+20+$A$1)))

then copy down as needed.

--
Hope that helps.

Vergel Adriano


"Mo2" wrote:

this is difficult to explain, but here goes nothing...

here's my sample formula, in Cell G25:
=IF(D25=0,0,IF(D45=0,0,B45))

This is what i want the macro to do:
Step1: read the number in cell A1. (lets say i type "2" in there)

Step2: Add "2" to every cell reference in G25's formula, except the
reference that refers to the current cell's row (in this case, row 25).

I.E. this would change G25's formula from: =IF(D25=0,0,IF(D47=0,0,B47))
to:
=IF(D25=0,0,IF(D47=0,0,B47))

STEP3: copy the new formula down for 20 rows.

I need this same thing to happen, if i type a number in A2
(except this time, it would be looking at the formula in I25
and following the same steps.
I25's formula is : =IF(D25=0,0,IF(D44=0,0,B44))


can anybody help me please?
if this can be done through some sort of pop up (which startup as soon as i
open the worksheet), instead of typing a number in a cell, even better. but
either way will work for me:)

thanks in advance

  #4   Report Post  
Posted to microsoft.public.excel.programming
Mo2 Mo2 is offline
external usenet poster
 
Posts: 34
Default need macro to edit formula...

problem!

when the formula was: =IF(D25=0,0,IF(D45=0,0,B45))
and when i copied it down,
it became =IF(D26=0,0,IF(D46=0,0,B46))
thats how i wanted it..

but with this formula:
=IF(D25=0,0,IF(INDIRECT("D" & 45+$A$1)=0,0,INDIRECT("B" & 45+$A$1)))

copied down, only the "D25" would will update to "D26" and so on.
but the "45" will remain a 45 when copy the formula down..
what to do?

i have hundreds of cells.. it will take me forever to change the 45 to 46,
47, 48, etc (for every new row i copy it down to)

is there another way?



"Mo2" wrote:

nice! thank you it works

i'll let you know if i have any more problems:)

thanks again




"Vergel Adriano" wrote:

If I understand it correctly, I think this should work (or at least give you
some idea to do what you're trying to accomplish). Try putting this formula
in G25:

=IF(D25=0,0,IF(INDIRECT("D" & 45+$A$1)=0,0,INDIRECT("B" & 45+$A$1)))

then copy down as needed. The row number of the cell references will always
be 45 plus whatever number is in A1. If you need the row number to increment
as you copy down, try it this way:

=IF(D25=0,0,IF(INDIRECT("D" & ROW()+20+$A$1)=0,0,INDIRECT("B" &
ROW()+20+$A$1)))

then copy down as needed.

--
Hope that helps.

Vergel Adriano


"Mo2" wrote:

this is difficult to explain, but here goes nothing...

here's my sample formula, in Cell G25:
=IF(D25=0,0,IF(D45=0,0,B45))

This is what i want the macro to do:
Step1: read the number in cell A1. (lets say i type "2" in there)

Step2: Add "2" to every cell reference in G25's formula, except the
reference that refers to the current cell's row (in this case, row 25).

I.E. this would change G25's formula from: =IF(D25=0,0,IF(D47=0,0,B47))
to:
=IF(D25=0,0,IF(D47=0,0,B47))

STEP3: copy the new formula down for 20 rows.

I need this same thing to happen, if i type a number in A2
(except this time, it would be looking at the formula in I25
and following the same steps.
I25's formula is : =IF(D25=0,0,IF(D44=0,0,B44))


can anybody help me please?
if this can be done through some sort of pop up (which startup as soon as i
open the worksheet), instead of typing a number in a cell, even better. but
either way will work for me:)

thanks in advance

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default need macro to edit formula...

Hi,

Try the second formula that I gave.

=IF(D25=0,0,IF(INDIRECT("D" & ROW()+20+$A$1)=0,0,INDIRECT("B" &
ROW()+20+$A$1)))



--
Hope that helps.

Vergel Adriano


"Mo2" wrote:

problem!

when the formula was: =IF(D25=0,0,IF(D45=0,0,B45))
and when i copied it down,
it became =IF(D26=0,0,IF(D46=0,0,B46))
thats how i wanted it..

but with this formula:
=IF(D25=0,0,IF(INDIRECT("D" & 45+$A$1)=0,0,INDIRECT("B" & 45+$A$1)))

copied down, only the "D25" would will update to "D26" and so on.
but the "45" will remain a 45 when copy the formula down..
what to do?

i have hundreds of cells.. it will take me forever to change the 45 to 46,
47, 48, etc (for every new row i copy it down to)

is there another way?



"Mo2" wrote:

nice! thank you it works

i'll let you know if i have any more problems:)

thanks again




"Vergel Adriano" wrote:

If I understand it correctly, I think this should work (or at least give you
some idea to do what you're trying to accomplish). Try putting this formula
in G25:

=IF(D25=0,0,IF(INDIRECT("D" & 45+$A$1)=0,0,INDIRECT("B" & 45+$A$1)))

then copy down as needed. The row number of the cell references will always
be 45 plus whatever number is in A1. If you need the row number to increment
as you copy down, try it this way:

=IF(D25=0,0,IF(INDIRECT("D" & ROW()+20+$A$1)=0,0,INDIRECT("B" &
ROW()+20+$A$1)))

then copy down as needed.

--
Hope that helps.

Vergel Adriano


"Mo2" wrote:

this is difficult to explain, but here goes nothing...

here's my sample formula, in Cell G25:
=IF(D25=0,0,IF(D45=0,0,B45))

This is what i want the macro to do:
Step1: read the number in cell A1. (lets say i type "2" in there)

Step2: Add "2" to every cell reference in G25's formula, except the
reference that refers to the current cell's row (in this case, row 25).

I.E. this would change G25's formula from: =IF(D25=0,0,IF(D47=0,0,B47))
to:
=IF(D25=0,0,IF(D47=0,0,B47))

STEP3: copy the new formula down for 20 rows.

I need this same thing to happen, if i type a number in A2
(except this time, it would be looking at the formula in I25
and following the same steps.
I25's formula is : =IF(D25=0,0,IF(D44=0,0,B44))


can anybody help me please?
if this can be done through some sort of pop up (which startup as soon as i
open the worksheet), instead of typing a number in a cell, even better. but
either way will work for me:)

thanks in advance



  #6   Report Post  
Posted to microsoft.public.excel.programming
Mo2 Mo2 is offline
external usenet poster
 
Posts: 34
Default need macro to edit formula...

hey.. umm...something's not right..
its still the same. As i copy the formula down,

the "D25" changes to "D26", "D26", etc, as it should..
but the "+20" stays as "+20" -- when it should change to "+21", "+22", etc
, as its copied down..

whats wrong?


"Vergel Adriano" wrote:

Hi,

Try the second formula that I gave.

=IF(D25=0,0,IF(INDIRECT("D" & ROW()+20+$A$1)=0,0,INDIRECT("B" &
ROW()+20+$A$1)))



--
Hope that helps.

Vergel Adriano


"Mo2" wrote:

problem!

when the formula was: =IF(D25=0,0,IF(D45=0,0,B45))
and when i copied it down,
it became =IF(D26=0,0,IF(D46=0,0,B46))
thats how i wanted it..

but with this formula:
=IF(D25=0,0,IF(INDIRECT("D" & 45+$A$1)=0,0,INDIRECT("B" & 45+$A$1)))

copied down, only the "D25" would will update to "D26" and so on.
but the "45" will remain a 45 when copy the formula down..
what to do?

i have hundreds of cells.. it will take me forever to change the 45 to 46,
47, 48, etc (for every new row i copy it down to)

is there another way?



"Mo2" wrote:

nice! thank you it works

i'll let you know if i have any more problems:)

thanks again




"Vergel Adriano" wrote:

If I understand it correctly, I think this should work (or at least give you
some idea to do what you're trying to accomplish). Try putting this formula
in G25:

=IF(D25=0,0,IF(INDIRECT("D" & 45+$A$1)=0,0,INDIRECT("B" & 45+$A$1)))

then copy down as needed. The row number of the cell references will always
be 45 plus whatever number is in A1. If you need the row number to increment
as you copy down, try it this way:

=IF(D25=0,0,IF(INDIRECT("D" & ROW()+20+$A$1)=0,0,INDIRECT("B" &
ROW()+20+$A$1)))

then copy down as needed.

--
Hope that helps.

Vergel Adriano


"Mo2" wrote:

this is difficult to explain, but here goes nothing...

here's my sample formula, in Cell G25:
=IF(D25=0,0,IF(D45=0,0,B45))

This is what i want the macro to do:
Step1: read the number in cell A1. (lets say i type "2" in there)

Step2: Add "2" to every cell reference in G25's formula, except the
reference that refers to the current cell's row (in this case, row 25).

I.E. this would change G25's formula from: =IF(D25=0,0,IF(D47=0,0,B47))
to:
=IF(D25=0,0,IF(D47=0,0,B47))

STEP3: copy the new formula down for 20 rows.

I need this same thing to happen, if i type a number in A2
(except this time, it would be looking at the formula in I25
and following the same steps.
I25's formula is : =IF(D25=0,0,IF(D44=0,0,B44))


can anybody help me please?
if this can be done through some sort of pop up (which startup as soon as i
open the worksheet), instead of typing a number in a cell, even better. but
either way will work for me:)

thanks in advance

  #7   Report Post  
Posted to microsoft.public.excel.programming
Mo2 Mo2 is offline
external usenet poster
 
Posts: 34
Default need macro to edit formula...

after fiddling around with it for a while, i think i answered my own question:)
this does the trick:
=IF(D25=0,0,IF(INDIRECT("D"&ROW(D45)+$A$1)=0,0,IND IRECT("B"&ROW(B45)+$A$1)))

thanks a lot.
I'll post back if i need more assistance:)

"Vergel Adriano" wrote:

Hi,

Try the second formula that I gave.

=IF(D25=0,0,IF(INDIRECT("D" & ROW()+20+$A$1)=0,0,INDIRECT("B" &
ROW()+20+$A$1)))



--
Hope that helps.

Vergel Adriano


"Mo2" wrote:

problem!

when the formula was: =IF(D25=0,0,IF(D45=0,0,B45))
and when i copied it down,
it became =IF(D26=0,0,IF(D46=0,0,B46))
thats how i wanted it..

but with this formula:
=IF(D25=0,0,IF(INDIRECT("D" & 45+$A$1)=0,0,INDIRECT("B" & 45+$A$1)))

copied down, only the "D25" would will update to "D26" and so on.
but the "45" will remain a 45 when copy the formula down..
what to do?

i have hundreds of cells.. it will take me forever to change the 45 to 46,
47, 48, etc (for every new row i copy it down to)

is there another way?



"Mo2" wrote:

nice! thank you it works

i'll let you know if i have any more problems:)

thanks again




"Vergel Adriano" wrote:

If I understand it correctly, I think this should work (or at least give you
some idea to do what you're trying to accomplish). Try putting this formula
in G25:

=IF(D25=0,0,IF(INDIRECT("D" & 45+$A$1)=0,0,INDIRECT("B" & 45+$A$1)))

then copy down as needed. The row number of the cell references will always
be 45 plus whatever number is in A1. If you need the row number to increment
as you copy down, try it this way:

=IF(D25=0,0,IF(INDIRECT("D" & ROW()+20+$A$1)=0,0,INDIRECT("B" &
ROW()+20+$A$1)))

then copy down as needed.

--
Hope that helps.

Vergel Adriano


"Mo2" wrote:

this is difficult to explain, but here goes nothing...

here's my sample formula, in Cell G25:
=IF(D25=0,0,IF(D45=0,0,B45))

This is what i want the macro to do:
Step1: read the number in cell A1. (lets say i type "2" in there)

Step2: Add "2" to every cell reference in G25's formula, except the
reference that refers to the current cell's row (in this case, row 25).

I.E. this would change G25's formula from: =IF(D25=0,0,IF(D47=0,0,B47))
to:
=IF(D25=0,0,IF(D47=0,0,B47))

STEP3: copy the new formula down for 20 rows.

I need this same thing to happen, if i type a number in A2
(except this time, it would be looking at the formula in I25
and following the same steps.
I25's formula is : =IF(D25=0,0,IF(D44=0,0,B44))


can anybody help me please?
if this can be done through some sort of pop up (which startup as soon as i
open the worksheet), instead of typing a number in a cell, even better. but
either way will work for me:)

thanks in advance

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default need macro to edit formula...

Hi,

When you put this

=ROW(D45)

in row 20, it will give you 45 and when you copy it down, you will see the
cell reference D45 increment. This formula:

=ROW() + 20

will give you the same result. But, you won't see any change in the formula
as you copy it down because ROW() will give you the current row number so it
increments internally when Excel evaluates the formula...



--
Hope that helps.

Vergel Adriano


"Mo2" wrote:

after fiddling around with it for a while, i think i answered my own question:)
this does the trick:
=IF(D25=0,0,IF(INDIRECT("D"&ROW(D45)+$A$1)=0,0,IND IRECT("B"&ROW(B45)+$A$1)))

thanks a lot.
I'll post back if i need more assistance:)

"Vergel Adriano" wrote:

Hi,

Try the second formula that I gave.

=IF(D25=0,0,IF(INDIRECT("D" & ROW()+20+$A$1)=0,0,INDIRECT("B" &
ROW()+20+$A$1)))



--
Hope that helps.

Vergel Adriano


"Mo2" wrote:

problem!

when the formula was: =IF(D25=0,0,IF(D45=0,0,B45))
and when i copied it down,
it became =IF(D26=0,0,IF(D46=0,0,B46))
thats how i wanted it..

but with this formula:
=IF(D25=0,0,IF(INDIRECT("D" & 45+$A$1)=0,0,INDIRECT("B" & 45+$A$1)))

copied down, only the "D25" would will update to "D26" and so on.
but the "45" will remain a 45 when copy the formula down..
what to do?

i have hundreds of cells.. it will take me forever to change the 45 to 46,
47, 48, etc (for every new row i copy it down to)

is there another way?



"Mo2" wrote:

nice! thank you it works

i'll let you know if i have any more problems:)

thanks again




"Vergel Adriano" wrote:

If I understand it correctly, I think this should work (or at least give you
some idea to do what you're trying to accomplish). Try putting this formula
in G25:

=IF(D25=0,0,IF(INDIRECT("D" & 45+$A$1)=0,0,INDIRECT("B" & 45+$A$1)))

then copy down as needed. The row number of the cell references will always
be 45 plus whatever number is in A1. If you need the row number to increment
as you copy down, try it this way:

=IF(D25=0,0,IF(INDIRECT("D" & ROW()+20+$A$1)=0,0,INDIRECT("B" &
ROW()+20+$A$1)))

then copy down as needed.

--
Hope that helps.

Vergel Adriano


"Mo2" wrote:

this is difficult to explain, but here goes nothing...

here's my sample formula, in Cell G25:
=IF(D25=0,0,IF(D45=0,0,B45))

This is what i want the macro to do:
Step1: read the number in cell A1. (lets say i type "2" in there)

Step2: Add "2" to every cell reference in G25's formula, except the
reference that refers to the current cell's row (in this case, row 25).

I.E. this would change G25's formula from: =IF(D25=0,0,IF(D47=0,0,B47))
to:
=IF(D25=0,0,IF(D47=0,0,B47))

STEP3: copy the new formula down for 20 rows.

I need this same thing to happen, if i type a number in A2
(except this time, it would be looking at the formula in I25
and following the same steps.
I25's formula is : =IF(D25=0,0,IF(D44=0,0,B44))


can anybody help me please?
if this can be done through some sort of pop up (which startup as soon as i
open the worksheet), instead of typing a number in a cell, even better. but
either way will work for me:)

thanks in advance

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
Macro to edit formula Tang123 Excel Discussion (Misc queries) 2 October 6th 05 08:33 PM
Macro to edit a formula. jimwood Excel Programming 1 June 15th 05 03:27 PM
MACRO TO EDIT CELL FORMULA !! jay dean Excel Programming 3 July 10th 04 04:05 PM
macro to edit formula steve Excel Programming 0 August 20th 03 11:45 PM
macro to edit formula Steve d'Apollonia Excel Programming 4 August 20th 03 09:41 PM


All times are GMT +1. The time now is 06:35 PM.

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"