Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA - Delete cell to right of cell

Hello,

I have a spreadsheet and in one column there are several values.
need a macro that will search column A and if a value exists, I wan
the contents in the cell to the right of that cell to be deleted.

Thanks in advance for the help

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel VBA - Delete cell to right of cell

Assume the values are hard coded (not produced by formulas) I understood
you to want to clear regardless of the value, rather than for a specific
value. If the latter, post back.

if Application.CountA(columns(1)) < 0 then
set rng = Intersect(columns(1).SpecialCells(xlConstants).Ent ireRow, _
Columns(2))
rng.ClearContents
End if

--
Regards,
Tom Ogilvy


"MAYDAY " wrote in message
...
Hello,

I have a spreadsheet and in one column there are several values. I
need a macro that will search column A and if a value exists, I want
the contents in the cell to the right of that cell to be deleted.

Thanks in advance for the help.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA - Delete cell to right of cell

Thanks Tom,

I apologize for not being more clear. What I'm trying to do is this:

If there is a cell in column A that has a value of 'abc'(hard coded, n
formulas), I want the contents in the cell to the right to be deleted

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel VBA - Delete cell to right of cell

dim rng as Range, cell as Range
if Application.CountA(columns(1)) < 0 then
set rng = Intersect(columns(1).SpecialCells(xlConstants).Ent ireRow, _
Columns(2))
for each cell in rng
if lcase(cell.Value) = "abc" then
cell.offset(0,1).ClearContents
end if
NExt
End if

--
Regards,
Tom Ogilvy


"MAYDAY " wrote in message
...
Thanks Tom,

I apologize for not being more clear. What I'm trying to do is this:

If there is a cell in column A that has a value of 'abc'(hard coded, no
formulas), I want the contents in the cell to the right to be deleted.


---
Message posted from http://www.ExcelForum.com/



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
Weird: inside of a cell I have a small box or cell I can't delete. ACECOWBOY Excel Discussion (Misc queries) 4 May 2nd 23 03:43 AM
In Excel, how do you delete gridlines for one cell? razorclam Excel Discussion (Misc queries) 2 December 18th 07 09:10 PM
How to delete cell values withour deleting cell formulae perfection Excel Discussion (Misc queries) 5 June 18th 07 09:05 PM
How to delete cell values without affecting cell formulae perfection Excel Discussion (Misc queries) 0 June 18th 07 06:55 AM
Delete cell contents with input to adjacent cell Ashley Frank Excel Discussion (Misc queries) 1 October 5th 05 04:28 PM


All times are GMT +1. The time now is 05:27 AM.

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"