ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If text found in Row, delete Column (https://www.excelbanter.com/excel-programming/388362-if-text-found-row-delete-column.html)

Jeff

If text found in Row, delete Column
 
Hello,

I'd like to be able to search a row for some text and, if found, delete that
column...

Appreciate any help.

RB Smissaert

If text found in Row, delete Column
 
Sub test()

Dim c As Long

'looking for values in row 4, starting in column 30

For c = 30 To 1 Step -1
If Cells(4, c) = 1 Then
Columns(c).Delete
End If
Next

End Sub


RBS


"JEFF" wrote in message
...
Hello,

I'd like to be able to search a row for some text and, if found, delete
that
column...

Appreciate any help.



Jeff

If text found in Row, delete Column
 
Thanks for the response.. a bit of a novice and couldn't get it to work:

** The text I'm looking for ("Adjust") will always be in row 10.....


"RB Smissaert" wrote:

Sub test()

Dim c As Long

'looking for values in row 4, starting in column 30

For c = 30 To 1 Step -1
If Cells(4, c) = 1 Then
Columns(c).Delete
End If
Next

End Sub


RBS


"JEFF" wrote in message
...
Hello,

I'd like to be able to search a row for some text and, if found, delete
that
column...

Appreciate any help.




RB Smissaert

If text found in Row, delete Column
 
Try this:

Sub test()

Dim c As Long

For c = 256 To 1 Step -1
If Cells(10, c) = "Adjust" Then
Columns(c).Delete
End If
Next

End Sub


RBS

"JEFF" wrote in message
...
Thanks for the response.. a bit of a novice and couldn't get it to work:

** The text I'm looking for ("Adjust") will always be in row 10.....


"RB Smissaert" wrote:

Sub test()

Dim c As Long

'looking for values in row 4, starting in column 30

For c = 30 To 1 Step -1
If Cells(4, c) = 1 Then
Columns(c).Delete
End If
Next

End Sub


RBS


"JEFF" wrote in message
...
Hello,

I'd like to be able to search a row for some text and, if found, delete
that
column...

Appreciate any help.





Jeff

If text found in Row, delete Column
 
Perfect... thank you

"RB Smissaert" wrote:

Try this:

Sub test()

Dim c As Long

For c = 256 To 1 Step -1
If Cells(10, c) = "Adjust" Then
Columns(c).Delete
End If
Next

End Sub


RBS

"JEFF" wrote in message
...
Thanks for the response.. a bit of a novice and couldn't get it to work:

** The text I'm looking for ("Adjust") will always be in row 10.....


"RB Smissaert" wrote:

Sub test()

Dim c As Long

'looking for values in row 4, starting in column 30

For c = 30 To 1 Step -1
If Cells(4, c) = 1 Then
Columns(c).Delete
End If
Next

End Sub


RBS


"JEFF" wrote in message
...
Hello,

I'd like to be able to search a row for some text and, if found, delete
that
column...

Appreciate any help.






All times are GMT +1. The time now is 05:29 PM.

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