I have a workbook with two sheets of data. I want to hide column B of Sheet2 and clear contents of range B2:B50 if the value in A1 of Sheet1 is "a". Can anyone help me with the code?
I have a workbook with two sheets of data. I want to hide column B of Sheet2 and clear contents of range B2:B50 if the value in A1 of Sheet1 is "a". Can anyone help me with the code?
Last edited by dittotharappel; 03-28-2009 at 12:18 PM.
Hello dittotharappel,
![]()
Sub HideAndClear() If Worksheets("Sheet1").Range("A1").Value = "a" Then Worksheets("Sheet2").Range("B2:B50").ClearContents Worksheets("Sheet2").Columns("B").Hidden =True End If End Sub
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
That works fine. Thanks a lot.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks