ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with some code please (https://www.excelbanter.com/excel-programming/307178-help-some-code-please.html)

RJC

Help with some code please
 
Hi All,

Could anyone help me with some code to do the following.
I've tried using formulas and filters and With statements
but can't get it resolved. It seems simple but there must
be some difficulty to it.

Basically, in Column J9:J18 I have some empty cells and
some cells containing dollar amounts. They are not always
in the same cells after I calculate my sheet.

In Column F9:F18, I also have empty cells and dollar
amounts.

What I'm trying to do is to scan J9:J18 for any cells with
amounts, and then, if found, copy that amount across to
the corresponding cell in Column F.

However, as there are amounts already in Column F and I
don't want these deleted. I just want any number found in
Column J to be identical to that in Column F on the same
line.

Hope I've explained it clearly enough.

Would appreciate if anyone could help me with this.

Thankyou in advance.
Regards



Bob Phillips[_6_]

Help with some code please
 

With Activeworkbook.Worksheets("Sheet1")
For i = 9 to 18
If .Cells(i,"F").Value < "" Then
.Cells(i,"J").Value = .Cells(i,"F").Value
ElseIf .Cells(i,"J").Value < "" Then
.Cells(i,"F").Value = .Cells(i,"J").Value
End If
Next i
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"RJC" wrote in message
...
Hi All,

Could anyone help me with some code to do the following.
I've tried using formulas and filters and With statements
but can't get it resolved. It seems simple but there must
be some difficulty to it.

Basically, in Column J9:J18 I have some empty cells and
some cells containing dollar amounts. They are not always
in the same cells after I calculate my sheet.

In Column F9:F18, I also have empty cells and dollar
amounts.

What I'm trying to do is to scan J9:J18 for any cells with
amounts, and then, if found, copy that amount across to
the corresponding cell in Column F.

However, as there are amounts already in Column F and I
don't want these deleted. I just want any number found in
Column J to be identical to that in Column F on the same
line.

Hope I've explained it clearly enough.

Would appreciate if anyone could help me with this.

Thankyou in advance.
Regards





RJ

Help with some code please
 
Thank you very much for your help, Bob.
Kind regards,
Rick

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

With Activeworkbook.Worksheets("Sheet1")
For i = 9 to 18
If .Cells(i,"F").Value < "" Then
.Cells(i,"J").Value = .Cells(i,"F").Value
ElseIf .Cells(i,"J").Value < "" Then
.Cells(i,"F").Value = .Cells(i,"J").Value
End If
Next i
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"RJC" wrote in

message
...
Hi All,

Could anyone help me with some code to do the following.
I've tried using formulas and filters and With

statements
but can't get it resolved. It seems simple but there

must
be some difficulty to it.

Basically, in Column J9:J18 I have some empty cells and
some cells containing dollar amounts. They are not

always
in the same cells after I calculate my sheet.

In Column F9:F18, I also have empty cells and dollar
amounts.

What I'm trying to do is to scan J9:J18 for any cells

with
amounts, and then, if found, copy that amount across to
the corresponding cell in Column F.

However, as there are amounts already in Column F and I
don't want these deleted. I just want any number found

in
Column J to be identical to that in Column F on the same
line.

Hope I've explained it clearly enough.

Would appreciate if anyone could help me with this.

Thankyou in advance.
Regards




.



All times are GMT +1. The time now is 10:17 PM.

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