Hello all,
With the following code the user can, by means of a combobox, adjust the number of rows he wants to be visible [between row 8 and 17]
i.e if the user selects 5 in the combobox, only 5 rows, starting from row 8 will be visible [row 8:12]
Taking above situation as example, [the user selects 5] the user can now enter data in range G8:M12.Rows("8:17").Hidden = False Rows(Val(ComboBox1.Value) + 8 & ":17").Hidden = True
When the user later adjust the number to 3 in the combobox, the data he entered in in range G10:M12 will he hidden.
What I would like is that whenever the user adjust the number, the contents of all hidden cells is cleared [but only those in columns G:M]
Last edited by Jonathan78; 01-27-2012 at 06:23 AM.
Impossible?
Its possible. You have to put a "Clearcontents" code line when hiding the rows.
So if i just add to your code above you need this line at the end -Rows(Val(ComboBox1.Value) + 8 & ":17").ClearContents
Cheers,
Arlette
If I helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
Thank you Arlu, it's almost what I need.
But I want it to clear only the contents of the columns G:M [instead of the complete rows]
Change the code torange("G" & (Val(ComboBox1.Value) + 8 & ":M17").ClearContents
Cheers,
Arlette
If I helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
Awesome!
Thanks Arlu!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks