can u share the sample file with us

Regards
Ashish


On Thu, Jul 4, 2013 at 7:07 AM, Brian Yam <briann...@gmail.com> wrote:

> Dear All,
>
> I am new to VBA programming
> I happen to need great and urgent help on a project that I am currently
> working on
> I would like to search through the worksheet, and find "N" or "TR" on row 6
> Then, For every cell in the column of "N" or "TR"
> if all the cells are blank, then delete/ hide the column
> if the cells are not blank, highlight the cells that are in blank
> This sounds easy but I think it requires two for loops.
> I appreciate any contributions!
>
>
>  Sub checkandhide()
> Set r = Range("6:6")
> Rows("7:7").Select
> For Each Cell In r
>      Selection.Find(What:="N", After:=ActiveCell, LookIn:=xlFormulas,
> LookAt _
>         :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
> MatchCase:= _
>         False, MatchByte:=False, SearchFormat:=False).Activate
>         'search for N
> Application.Run "deletecolumn"
> Next
> End Sub
> *Sub deletecolumn()
> ActiveCell.Offset(6, 0).Select
> Range(Selection, Selection.End(xlDown)).Select
> For Each Cell.Value In Selection
> If Cell.Value = "" Then
>         'some code that let the loop goes on
> Else
> ActiveCell.Columns.Delete
> End If
> Next
> End Sub*
>
> <https://lh6.googleusercontent.com/-mbWxnUGYXQ8/UdTP5k_XBtI/AAAAAAAAAA8/wSQW-PG043o/s872/help.png>
>
> --
> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
> https://www.facebook.com/discussexcel
>
> FORUM RULES
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
> will not get quick attention or may not be answered.
> 2) Don't post a question in the thread of another member.
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
> 4) Acknowledge the responses you receive, good or bad.
> 5) Jobs posting is not allowed.
> 6) Sharing copyrighted material and their links is not allowed.
>
> NOTE : Don't ever post confidential data in a workbook. Forum owners and
> members are not responsible for any loss.
> ---
> You received this message because you are subscribed to the Google Groups
> "MS EXCEL AND VBA MACROS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to excel-macros+unsubscr...@googlegroups.com.
> To post to this group, send email to excel-macros@googlegroups.com.
> Visit this group at http://groups.google.com/group/excel-macros.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
*Regards*
* *
*Ashish Koul*


*Visit*
*My Excel Blog <http://www.excelvbamacros.com/>*
Like Us on 
Facebook<http://www.facebook.com/pages/Excel-VBA-Codes-Macros/151803898222297>
Join Us on Facebook <http://www.facebook.com/groups/163491717053198/>


P Before printing, think about the environment.

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to