Macro: Changing the value of a Cell

Costafrank

New Member
Joined
Feb 6, 2004
Messages
2
Hello,


How can I change the value of one cell if another cell has a string.

ex:

Row 1 Colum 7(G1) Has the value of "TEST" (or anyother string) now I would like to change row 1 colum 2 (b1) to "TEST" if it is empty, I would like to do an autofill from the cell above.

thanks
Frank
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Greg Truby

MrExcel MVP
Joined
Jun 19, 2002
Messages
10,022
Costafrank said:
...if it is empty... do an autofill from the cell above...

<ul>[*]If what is empty? B1 or G1?[*]What cell is "above"? You're in row 1.[/list]
 

Costafrank

New Member
Joined
Feb 6, 2004
Messages
2
Greg,

If G1 is empty. I would like it to fill from above because I will always have one row at the top, with a valid formula.

I choose ROW 1 and COLUM 1 just as an example.

you can make it ROW 2 COLUM 2 (B2) & ROW 2 COLUM 7 (G2).

also, it needs to check on a range of cells so G2-G500 and update the appropiate cell in range (b2-b500)


thanks
Frank
 

Greg Truby

MrExcel MVP
Joined
Jun 19, 2002
Messages
10,022
If I've understood you accurately, the easiest way to do this would be to just use an IF() function to test for blanks. One certainly could quite literally make so that column G was checked for a value and copy a formula down in col B, but that would involve the use of VB and why make life more complicated than need be? Note, to keep the HTML shorter, I used col C as the column to test here, just change that to G and copy down as far as you need to.

HTH
Book1
ABCD
1DummyDataIfcolCisempty,multiplyA*5ColtoCheckComments
215Hello
32103.141592654
43159-Feb-04
54 <--Blank
65250<--Zero(notblank)
Sheet1
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,151,876
Messages
5,766,875
Members
425,383
Latest member
IllDo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top