ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   modification to existing code to If statement (https://www.excelbanter.com/excel-programming/367826-modification-existing-code-if-statement.html)

JOUIOUI

modification to existing code to If statement
 
I use this code to move amounts from column K (11) to column G in the same
row and then delete the contents in the cell in column K. My problem is that
I get an error if there is not amounts in column K. I'm not sure how I would
alter this to say if there is text in col K move it to column G so I don't
get the soft edit. Any ideas. Thank you


Set rng = Columns(11).SpecialCells(xlConstants)
For Each Cell In rng
Cells(Cell.Row, "G").Value = Cell.Value
Next
rng.ClearContents

Don Guillett

modification to existing code to If statement
 
try
on error resume next

--
Don Guillett
SalesAid Software

"JOUIOUI" wrote in message
...
I use this code to move amounts from column K (11) to column G in the same
row and then delete the contents in the cell in column K. My problem is
that
I get an error if there is not amounts in column K. I'm not sure how I
would
alter this to say if there is text in col K move it to column G so I don't
get the soft edit. Any ideas. Thank you


Set rng = Columns(11).SpecialCells(xlConstants)
For Each Cell In rng
Cells(Cell.Row, "G").Value = Cell.Value
Next
rng.ClearContents




JOUIOUI

modification to existing code to If statement
 
Where in my code to I put that text Don. I've tried in various places but I
still ge the debug error. I appreciate your help thanks

"Don Guillett" wrote:

try
on error resume next

--
Don Guillett
SalesAid Software

"JOUIOUI" wrote in message
...
I use this code to move amounts from column K (11) to column G in the same
row and then delete the contents in the cell in column K. My problem is
that
I get an error if there is not amounts in column K. I'm not sure how I
would
alter this to say if there is text in col K move it to column G so I don't
get the soft edit. Any ideas. Thank you


Set rng = Columns(11).SpecialCells(xlConstants)
For Each Cell In rng
Cells(Cell.Row, "G").Value = Cell.Value
Next
rng.ClearContents






All times are GMT +1. The time now is 10:58 AM.

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