Hey guys thanks but ..I copy the code into new sheet, and it works perfect too.. it is just in that original sheet, it only works for 0 ,but rest of them..
please open the sheet and take a look.. On Fri, Jun 12, 2009 at 3:13 PM, Fabio Lemos <flnle...@gmail.com> wrote: > I have tested and it works for me.... > Have you turnedmacros on? > > > > 2009/6/12 zheng yu <vincent2...@gmail.com> > >> Hi All, >> >> I got this request from a colleague who is asking me to find out the >> problem assuming i am the best VBA and C++ programmer here.;P >> >> But I can't fix it. I can create a new sheet with same functions and it >> works..but I can't fix this one. Please take a look. >> >> in sheet" Parametervalg" there is a simple Worksheet_change event, and I >> just put these lines of code there. And amazingly they don't work. >> >> The problem is that in Range("C5"), there is 5 numbers you can choose >> 0,1,2,3,4,5. And when you choose 0, it will hide certain columns; when you >> choose 1 it will unhide them. Rest of numbers do similar things. But when I >> choose 0, it doesn hide all columns, and when i choose 1, it DOES NOT unhide >> all of them.... when I write this piece of code in a new sheet,it works just >> fine..... >> >> Private Sub Worksheet_Change(ByVal Target As Range) >> >> If Target.Value = "0" Then >> MsgBox "000" >> 'Sheets("Parametervalg").Select >> Columns("G:K").EntireColumn.Hidden = True >> End If >> >> If Target.Value = "1" Then >> MsgBox "111" >> Columns("G:K").EntireColumn.Hidden = False >> End If >> >> end sub >> >> >> By the way, anyone here in the forum does Excel-addin C++ development ? >> >> Vincent >> >> >> >> >> > > > -- > Fabio Lemos > > e-mail: flnle...@gmail.com > > > > --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---