Hide/Show Sheets Based On Cell Values & Validate Entry

May 30, 2008

excal VBA programming.I have attached the file name "help" for your easy explanation purpose.

1. Is it possible to hide sheet nos. 1,2,3,4 & unhide the sheet as wished by me by puting the value (1or 2 or 3 or 4) in B3 cell.

2.There are per day production rate in E18 to E22 cell. Now whenever I will give value in H18 or H19 or H20 or H21 or H22, it will check whether the value is same with the respective E 18 or E19 or E20 or E21 or E22 cell. If both the values are not equal then give a message box "WARNING!!! YOUR VALUE IS NOT SAME". Can it be possible by creating VBA programming.

View 5 Replies


ADVERTISEMENT

Show / Hide Sheets Based On Values Of Cells In Range?

Sep 11, 2013

I have a workbook wherein I have 7 sheets.Lets say they are called Tom, Peter, John, Sia, Mia, Tia and "Home Page". I have 2 buttons for Report 1 and 2 to which I want to assign the macros.I also have a table wherein I have defined which sheets I want to show. First Column of table has sheet names from A2:A6(Home Page,Tom, Peter, John, Sia, Mia, Tia). Column 2 has report 1 sheets - Home Page, Tom, John, Mia and Column 3 has report 2 sheet names- Home Page, Peter, Sia, Tia

What I want to do is, if I click on "Report 1" button, I only want to show sheets whose names are there in cells under report 1 so for report 1 it will be Home Page, Tom, John, Mia. For Report 2, it will be Home Page, Peter, Sia, Tia. Since I have many reports I want this to be one macro. Stepwise, here is what I want

1. Click on button for Report, macro should check which report I am referring to and select the range on basis of that. Report 1 = column B, if Report 2, Range is column C.
2. Basis the range I want sheets to show or hide.

View 1 Replies View Related

Hide & Show Sheets Based On Names

Dec 19, 2006

I made one file with 13 sheets.

sheet1 tab name is : MAIN
and other sheet tab name like following
2. xyz-Sales
3. xyz-Rev
4. xyz-SSN
5. xyz-ddn
6. abc-Sales
7. abc-Rev
8. abc-ddn
9. abc-ssn
10. ddd-sales
11. ddd-Rev
12. ddd-ssn
13. ddd-ddn

In Main sheet There are 3 buttons

1 . XYZ
2. abc
3. ddd

when user press on xyz button then only xyz sheets (like sheet 2 to 5) are shows to user and other sheets are very hide

if user press abc button then only abc sheets (like sheet 6 to 9) are shows to user and other sheets are very hide

i don't want to use

Sheet2.Visible = xlSheetVeryHidden

i want to use finde xyz sheet tab name and shows and other are hide.

View 9 Replies View Related

Hide Or Show An Image Based On A Cell Value

Mar 31, 2009

I have a spreadsheet with two bitmap images inserted into it. In cell E2, I will enter a number, either a 1 or a 2. if I enter a 1, I want only the first image to be visible. If I enter a 2, I only want the second image to be visible. Is there a way to accomplish this (hopefully without the need for macros)? I've attached a spreadsheet as an example of what I'm trying to do. Also, note that I'd like the images to be stacked on top of each other so that they show up in the same place regardless of wether there's a 1 or a 2 in cell E5

View 13 Replies View Related

Hide & Show Rows Based On Cell Value

Jun 10, 2008

I have two sheets say:

Sheet1
Sheet2

Sheet1 has a few comboboxes saying (YES / NO) conditions Which are assigned to particular cells (for Ex: say Combobox1 value assignes to Sheet1!B5 )

If Sheet!B5 = YES some rows in Sheet2 Say ( Row12 ,Row 15,Row 16) has to be hide.

I will add a command button to sheet1 and call macro if i click command button checking the conditions in sheet1 combo boxes..rows in sheets2 has to hide..

View 4 Replies View Related

Automatically Hide / Show Rows Based On Cell Value

May 7, 2013

Trying to have A1 in Sheet1 having three values 1,2,3 if A1 = 1 hide rows from 1:5 and 10:1500 in three Sheets2,3,4

View 8 Replies View Related

Conditionally Show / Hide Combobox Based On Cell Value

Jun 5, 2013

I'm quite new to VBA, but I am attempting to get a Forms ComboBox to appear or disappear based on whether a certain cell (P7) reads YES or NO. P7 in turn updates in turn based on a user-selected value. As of now, the ComboBox only appears or disppears if I go back in and out of the formula I entered into P7. Basically, I want my ComboBox to dynamically update based on the value in P7. That may sound a little muddled, so here is my code for the ComboBox:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("P7")) Is Nothing Then
If UCase(Target) = "YES" Then
Me.Shapes.Range("Drop Down 30").Visible = msoTrue
Else
Me.Shapes.Range("Drop Down 30").Visible = msoFalse
End If
End If

End Sub

View 3 Replies View Related

Automatically Hide / Show Rows Based On Cell Value

Feb 27, 2008

I wrote a small code to hide some columns if a certain cell is equal to a certain string.

The cell is actually a drop down list and when they select a certain one, I want it to hide 2 columns. So I wrote the code with sub name Action, but I want it to be running all the time. I tried to achieve this by writing the following code however it gave me error 438 for my 2nd line.

Sub Auto_Open()
Range("A1").OnEntry = "Action"
End Sub

Auto Merged Post Until 24 Hrs Passes;Oh, by the way error 438 states: Object doesn't support this property or method

View 3 Replies View Related

Show/Hide Worksheet Command Button Based On Cell Value Being In Another Range

Apr 8, 2008

i have a workbook with two sheets. i have a command button on sheet 1 that inserts another worksheet from another workbook based on a cell value in sheet 1. i would like this specific command button on sheet 1 to be hidden or disabled until a value is entered into a certain cell on sheet 1 that matches a value in a named range on sheet 2.

View 7 Replies View Related

Show Sheets Based On Cell Value

Dec 12, 2008

I have 15 sheets - Resident 1, Resident 2 etc

If cell A1 on Summary tab contains 10, I want sheets Resident 1 to Resident 10 visible, everything over Resident 10 to be invisible

If cell A1 on Summary tab contains 5, I want sheets Resident 1 to Resident 5 visible, everything over Resident 5 to be invisible

View 9 Replies View Related

VBA To Hide/Unhide Sheets Based On Cell Value

Jun 2, 2008

I have a workbook which has roughly 50 sheets. What I'm trying to do is automatically hide/unhide sheets based on the cell values in the first sheet. So in sheet1 cell A1 i would a value of FALSE which would trigger sheets1, 2, & 3 to hide, when that value changes to TRUE then those same sheets would unhide. I need to replicate that for the 10 corresponding sets of sheets, but for each grouping of sheets a different cell in sheet1 would be the trigger, cell A2 = sheets 4 - 10, cell A3 = sheets 11 - 20, etc.

View 9 Replies View Related

Hide Column Based On Another Sheets Cell Value

Apr 16, 2008

There are 2 sheets in the excel worksheet. in one sheet there would be drop downs
the 2nd sheet will have 4 columns A,B,C,D) Depending on the selection in sheet1. If a1 = Y then columnA in the 2nd sheet should be hidden. If a1 = N then columnB in the 2nd sheet should be hidden. how can this be done..The key is the columns to be hidden are on a different sheet and that is where I am having the difficulty.

View 3 Replies View Related

Hide And Delete Sheets Based On Cell Input?

Aug 11, 2014

I have a situation where i would like to hide and delete a few sheets in my worksheet.

there is a few sheets where i want it to be constantly visible and one sheet is based on a cell reference.

the remaining irrelevant sheets i would like it to be hidden and deleted.

'always visible are sheets that are constantly visible in all files' 'visible msds is the sheet where my product data is being pulled out based on a input i enter on my first sheet' the sheets i want to hide and delete will be the remaining irrelevant "MSDS" that i would like to remove through macro.

View 3 Replies View Related

Show / Hide Sheets Per Username

Mar 8, 2014

I'm trying to only show specific sheets per user using the environ variable and this code seems to work for the single user / sheet but the master user does not function correctly i.e. the code does not show all sheets, this is the code I am using:

[Code] ......

Why the above code does not respect the Master User "Jane" should be able to see all sheets?

Original source for this code was found here:

HTML Code:  [URL]....

View 7 Replies View Related

Hide & Show Sheets Automatically

Dec 28, 2006

I would like to be able to use the before save event to hide some sheets before the save then after unhide some sheets. So that the user carrys on with the sheets they had before saving but when the document is reopened the correct sheets are hidden.

This is what I have so far but unfortunately when you click close and then save changes it runs the before save code and then goes around in circles, reasking the user if they want to save changes

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim ws As Worksheet

Cancel = True
Application.EnableEvents = False
Sheets("Protected Content").Visible = True
For Each ws In Worksheets
If ws. Name <> "Protected Content" Then ws.Visible = False
Next ws
Me.Save
For Each ws In Worksheets
ws.Visible = True
Next ws
Sheets("Protected Content").Visible = False
Application.EnableEvents = True

End Sub

View 3 Replies View Related

Validate Cell Entry To Be Less Than Another Cell

Sep 20, 2007

i have a data validation problem is there a way i can use =INDIRECT(DEC!'Ai11>DEC!'AJ11) is this correct? when the cell in dec AI11 is greater than AJ11 i need a validation stop to take place

View 9 Replies View Related

Hide/show Multiple Sheets By Macro?

Oct 29, 2008

I got a quite huge excel file with multiple sheets. For convenience sake I want to group and hide all the sheets not necessary for the viewer.

View 14 Replies View Related

Hide/Show Sheets Chosen In ComboBox

Feb 9, 2010

Sub ComboBox1_Chg()
For Each Sheet In Worksheets
If Sheet. Name <> "CoverPage" And Sheet.Name <> Sheets("CoverPage").ComboBox1 Then
Sheet.Visible = False
Else: Sheet.Visible = True
End If
Next Sheet
End Sub

It works if I step through it (F8) but the ComboBox doesn't work. It's named ComboBox1, and in the properties the ListFillRange shows all of the names in the list in the ComboBox correctly.

View 5 Replies View Related

Hide Columns Based On A User Entry

Mar 28, 2009

Is there a way of a user can add a number in a cell and this would hide a different amount of columns.

OR :

Ideally I would prefer a drop down with dates and the user could select a forward date and all the columns with dates up to that would appear. This would mean they could look as far our as required and all unwanted data would be hidden.

View 4 Replies View Related

VBA To Validate Entry?

Feb 25, 2014

I have a range of cells (A1:A50). If "Hello" is written in any of those cells then a MsgBox says "Are you sure?". If vbYes the cell is colour coded blue. If vbNo then it is red.

The problem I have is that "Hello" may already exist within the above range. I only want the above to fire on the cell that has just been changed within the range.

I have some code but it checks every cell within the range whenever any cell is changed within the range. Whereas I just want it to fire on the active cell if that makes sense?

View 11 Replies View Related

Validate Date Entry

Mar 27, 2014

I have a ComboBox on a UserForm. One of the fields that I fill in is a date.

After the date is entered I want to check if it's a valid date.

VB:
Private Sub cboEnterDate_Exit(ByVal Cancel As MSForms.ReturnBoolean)
' Make sure a valid date was entered, it must be in the format 2013/10/21.
On Error Goto ERR

'If Not IsDate(cboEnterDate.Value) Then

[Code] .....

ERR:
MsgBox "The date entered is not a valid date", vbInformation
Cancel = True
cboEnterDate_Enter
End Sub

The code:
VB:
'If Not IsDate(cboEnterDate.Value) Then
execute the If routine if I enter the date 2014/03/33

When I enter the date 2014/03/0001 it do not see it as an invalid date and exit the routine.

The code:
VB:
If Not IsDate(FormatDateTime(cboEnterDate.Value, vbShortDate)) Then
send the execution to the ERR routine if I enter 2014/03/33

When I enter the date 2014/03/0001 it do not see it as an invalid date and exit the routine.

How can I get the validation to catch the 2014/03/0001 as an invalid date as well.

View 3 Replies View Related

Validate InputBox Entry

Feb 11, 2008

validation up to the point that the user can click cancel and exit, also when nothing is entered a msgbox appears and for the 3rd inputbox a value greater than 0 must be entered.

Sub Trajectory() 'Trajectory macro
t0 = InputBox("Enter a value for the initial time(t0)")
'If t0 = "" Then MsgBox ("You must enter a value for t0!")
'Exit Sub
tf = InputBox("Enter a value for the final time(tf)")
'If tf = "" Then MsgBox ("You must enter a value for tf!")
'Exit Sub
Dt = InputBox("Enter a value for the time increment(Dt)")
'If Dt = "" Then MsgBox ("You must enter a value for Dt!")
'Exit Sub
'If Dt = 0 Then MsgBox ("You must have a valid increment")
x0 = Val( Range("F4"))
v0 = Val(Range("F5"))
g = Val(Range("F6"))
y0 = Val(Range("F7"))
q0 = Val(Range(" F8"))
Selection.Formula = FILL_TABLE
End Sub

View 9 Replies View Related

Hide Rows Based On Two Cell Values

Feb 1, 2009

Is there any way to hide a row if columns 6 and 7 both show either a "-" or a number lower than 0.5? Cells in both rows contain a VLOOKUP formula.

View 9 Replies View Related

Hide Rows Based On Other Cell Values

Sep 8, 2007

I need to hide rows on a worksheet based on entries from DATA VALIDATION dropdown lists on another. Due to the fact that all the entries are on a different page, and there is no active cells or entries made on the "second" worksheet, the WORKSHEET_CHANGE events will NOT work. Trust me, I have spent two days searching the net for a possible answer and trying every trick I could find. Not to seem redundant or a pain, but right from the git-go, FORGET the WORKSHEET_CHANGE event as an option. I need a way to fire the macros from a formula change in a linked cell, and it won't be an active cell, nor will there be any kind of entry made on that page at all. ALl the entries (choices) will be made on another sheet, but the result needs to be hiding the rows not required based on the choices I make. There are over 300 lines and when I am done there will be only approximately 35-40 left. Right now the people using this are actually making copies of the workbook, and then deleting the worksheets they don't need (I am hiding those with an array) and then deleting the lines they don't need on the worksheet remaining. (Stupid and slow I know, but I didn't develop this workbook, I'm just trying to bring it out of the stone age) Here is some sample code with what I want to do, except it is of a WORKSHEET_CHANGE nature and will not work.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("INPUT!M6"), Target) Is Nothing Then
Rows("11:50").Hidden = True
If LCase(Range("INPUT!M6").Value) = "100" Then Rows("31:50").Hidden = True
If LCase(Range("INPUT!M6").Value) = "100" Then Rows("11:30").Hidden = False
If LCase(Range("INPUT!M6").Value) = "225" Then Rows("11:30").Hidden = True
If LCase(Range("INPUT!M6").Value) = "225" Then Rows("31:50").Hidden = False
If LCase(Range("INPUT!M6").Value) = "0" Then Rows("11:50").Hidden = False
End If
End Sub

View 9 Replies View Related

Validate Email Address Entry

Jul 3, 2007

How it is possible to control the entry for the E-mail address?
I mean if there is no '@' or '.' and more that I dont know, maybe you know better and faced to such problem

View 9 Replies View Related

Hide Range Of Rows Based On Cell Values

Aug 13, 2014

I've been trying to put together some code to hide a range of rows on one page based on cell values on a different page. So basically Sheet1 cell A1 value is 10, A2 value is 20. When macro is run via button rows on Sheet2 from 10-20 would be hidden. The issue is the values in the cells on Sheet1 will vary. I thought something like the following would work but it doesn't.

[Code] ....

View 6 Replies View Related

Hide Rows Based On Values In A Cell Automatically

Apr 8, 2014

I am trying to hide rows based on values in a cell in that row. I have formulas in column xea that yields a 0 or 1 and I want to hide all rows with 0.

The code below works but I have to run the macro. I want it to happen automatically when the cell values change and I have not been able to figure it out.

Sub HideRows()
Application.ScreenUpdating = False
Application.Calculation = xlManual

For Each c In Range("xea1:xea350")

[Code] ........

View 9 Replies View Related

Validate Cell Values?

Apr 7, 2009

I would like to simply validate the value entered to a cell against cells of a number of columns. I’d like it to return a vlue to be able to report it in another cell as below. (had to cmma separate the columns, can't get them aligned in this editor)

A, B, C, D, Q, R
1, b, 1, 2, 1, existing

or

A, B, C, D, Q, R
1, b, 1, 2, 5, not existing

So the user enters a value in cell Q to check against the other columns and return a value to R. Additionally, the cells to be validated (A - D) may contain more than one character, i.e. cell A could = 1b2.

View 4 Replies View Related

VBA - Hide / Show Values Of 0 Or Higher

Jul 1, 2013

Basically, I am looking for a macro code to link to an 'Update' button that will do the following;

I will have 2 sheets, one sheet will be referencing data from other sheet with the following

=IF(Log Sheet!A4="Yes",(A1),"0")

This means, if it needs to be 'referred' it will go to the other sheet, and if it doesn't, then it wont and it will show up as 0.

Basically, every row will have this type of formula for 30 columns, and i would like a macro code that will hide values of 0, but even once hidden, will then show them again if in the other spreadsheet i change the value to yes, meaning i want the previously hidden row to show.

View 1 Replies View Related

How To Validate Time In Data Entry Form

Apr 12, 2012

I'm making a data entry form for a user, and one of the fields is in a time format (mm:ss). Is there any way that I can validate that field in "cmdOK_Click()" so that when the user clicks "ok" on the data entry form, if they haven't entered a date a msgbox comes up.

I tried IsNumeric with an If function but to no prevail.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved