ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cell values copied!! (https://www.excelbanter.com/excel-programming/282786-cell-values-copied.html)

aapp81

cell values copied!!
 

i have 2 columns - W and F
i need some type of macro that if a cell in W is greater than ""
cell in F, then F's value will automatically appear in W.

example:

w2 is 40
f2 is 30

therefore w2 should become 40

the W column is already filled and i'm filling in F cell by cell fro
outside info.

also, the cells are compared to their "rows" only meaning w2 = f2 an
so on, not w2 = f5, etc...

the macro doesn't have to loop as i type in column f... meaning i'll b
very happy w/ a macro that i can just run once when i feel like it an
it'll just take care of the 2 columns for me. but either will do...

thanks

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com


jeff

cell values copied!!
 
What you wrote and what you said in your example aren't
quite the same, but I think I am reading your question
correctly. If W is greater than F, put the value of F
into W?

If you use the IF command in column W, it will be quite
easy.

Your formula will look like:

=IF(W2F2,F2,W2)

This formula says that if W2 is greater than F2, Excel
will put the value of F2 into cell W2. Otherwise, it
will keep the original value of W2 in the cell.



-----Original Message-----

i have 2 columns - W and F
i need some type of macro that if a cell in W is greater

than "" a
cell in F, then F's value will automatically appear in W.

example:

w2 is 40
f2 is 30

therefore w2 should become 40

the W column is already filled and i'm filling in F cell

by cell from
outside info.

also, the cells are compared to their "rows" only

meaning w2 = f2 and
so on, not w2 = f5, etc...

the macro doesn't have to loop as i type in column f...

meaning i'll be
very happy w/ a macro that i can just run once when i

feel like it and
it'll just take care of the 2 columns for me. but either

will do...

thanks!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/

.


mudraker[_20_]

cell values copied!!
 

for i = 1 to range.[w65536].End(xlUp).Row step 1
if range("w" & i ).value range("f" & i).value then
range("f" & i).value = range("w" & i).value
end if
next i



' range.[w65536].End(xlUp).Row gets last row in column W that has a
entr

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com


aapp81[_2_]

cell values copied!!
 

thanks a lot - just what i was looking for

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com


Tom Ogilvy

cell values copied!!
 
Sub UpdateW()
for each cell in Range(cells(1,"W"),Cells(rows.count,"W").End(xlup) )
if cells(cell.row,"F").Value < cell.Value then _
cell.Value = cells(cell.row,"F").Value
Next
End Sub

--
Regards,
Tom Ogilvy


"aapp81" wrote in message
...

i have 2 columns - W and F
i need some type of macro that if a cell in W is greater than "" a
cell in F, then F's value will automatically appear in W.

example:

w2 is 40
f2 is 30

therefore w2 should become 40

the W column is already filled and i'm filling in F cell by cell from
outside info.

also, the cells are compared to their "rows" only meaning w2 = f2 and
so on, not w2 = f5, etc...

the macro doesn't have to loop as i type in column f... meaning i'll be
very happy w/ a macro that i can just run once when i feel like it and
it'll just take care of the 2 columns for me. but either will do...

thanks!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/




Tom Ogilvy

cell values copied!!
 
Sub UpdateW()
for each cell in Range(cells(1,"W"),Cells(rows.count,"W").End(xlup) )
if not isempty(cells(cell.row,"F")) then
if cells(cell.row,"F").Value < cell.Value then _
cell.Value = cells(cell.row,"F").Value
End If
Next
End Sub

Probably should check to make sure F has a value.

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
Sub UpdateW()
for each cell in Range(cells(1,"W"),Cells(rows.count,"W").End(xlup) )
if cells(cell.row,"F").Value < cell.Value then _
cell.Value = cells(cell.row,"F").Value
Next
End Sub

--
Regards,
Tom Ogilvy


"aapp81" wrote in message
...

i have 2 columns - W and F
i need some type of macro that if a cell in W is greater than "" a
cell in F, then F's value will automatically appear in W.

example:

w2 is 40
f2 is 30

therefore w2 should become 40

the W column is already filled and i'm filling in F cell by cell from
outside info.

also, the cells are compared to their "rows" only meaning w2 = f2 and
so on, not w2 = f5, etc...

the macro doesn't have to loop as i type in column f... meaning i'll be
very happy w/ a macro that i can just run once when i feel like it and
it'll just take care of the 2 columns for me. but either will do...

thanks!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/






Tom Ogilvy

cell values copied!!
 
are you suggesting intentional circular references or you just don't know?
If you enter a formula in W, how does W get a value to start with?

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
...
What you wrote and what you said in your example aren't
quite the same, but I think I am reading your question
correctly. If W is greater than F, put the value of F
into W?

If you use the IF command in column W, it will be quite
easy.

Your formula will look like:

=IF(W2F2,F2,W2)

This formula says that if W2 is greater than F2, Excel
will put the value of F2 into cell W2. Otherwise, it
will keep the original value of W2 in the cell.



-----Original Message-----

i have 2 columns - W and F
i need some type of macro that if a cell in W is greater

than "" a
cell in F, then F's value will automatically appear in W.

example:

w2 is 40
f2 is 30

therefore w2 should become 40

the W column is already filled and i'm filling in F cell

by cell from
outside info.

also, the cells are compared to their "rows" only

meaning w2 = f2 and
so on, not w2 = f5, etc...

the macro doesn't have to loop as i type in column f...

meaning i'll be
very happy w/ a macro that i can just run once when i

feel like it and
it'll just take care of the 2 columns for me. but either

will do...

thanks!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/

.




Tom Ogilvy

cell values copied!!
 
if you are talking about mudraker's code

you said:
need some type of macro that if a cell in W is greater than "" a
cell in F, then F's value will automatically appear in W.


As written, W's value appears in F.

--
Regards,
Tom Ogilvy


"aapp81" wrote in message
...

thanks a lot - just what i was looking for!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/





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

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