VBA Hide Text Boxes Based On Cell Value?
Oct 1, 2012
I have the code below on a worksheet to modify a form based if it's a Purchase order or not. It works but it seems like it could be much shorter. I tried several different ways to write it but I can't get it to work any other way.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
' If cell E5 = "Purchase Order" remove sales tax % from E33 and Hide Text Boxes 1 and 8
If Target.Address = Range("E5").Address Then
If Target = "Purchase Order" Then
Range("E33").Value = 0
With ActiveSheet.Shapes("Text Box 1")
If ActiveSheet.Range("E5") = "Purchase Order" Then
.Visible = False
[code].....
View 3 Replies
ADVERTISEMENT
Feb 8, 2012
I am looking for some macro code that will hide all rows except for those with certain text (i.e. W-NT or S1-DT). The cell range to search is C22-OU500.
View 5 Replies
View Related
Jan 10, 2009
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 13 Then Exit Sub
If InStr(Target.Value, "Other (specify in next column)") Then
Columns("N").Hidden = False
ElseIf WorksheetFunction. CountIf(Columns("M"), "Other (specify in next column)") = 0 Then
Columns("N").Hidden = True
End If
End Sub
but I have a lot of columns that I need to perform as above and I have put the code together as below
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Column = 13 And InStr(Target.Value, "Other (specify in next column)") Then
Columns("N").Hidden = False
ElseIf WorksheetFunction.CountIf(Columns("M"), "Other (specify in next column)") = 0 Then.................
Using the above code, when I selected more than one cell anywhere in my workbook and pressed delete I was bugging out with a runtime error 13 message. You can see from the above code that I inserted "On Error Resume Next" - this got rid of the runtime error 13 message, but now when I select more than one cell and press delete, hidden columns are incorrectly revealed in my worksheet. how I can extend the working code at the top of this posting so that it works for a number of different columns in my Worksheet i.e. without the runtime error 13 occurring and without columns being incorrectly revealed.
View 8 Replies
View Related
Dec 31, 2009
I want to populate the values of two textboxes that we will call TextBox5 and TextBox6 from columns W and X of a spreadsheet called "PowerAnalysis" when a selection is made form ComboBox5.
The ComboBox5 works perfectly now. I just need it to populate the other two text boxes.
All the data resides in the same row on the same sheet of PowerAnalysis when the selection is made in ComboBox5.
I hope I have been able to give a clear picture of what I am wanting to do.
View 9 Replies
View Related
Oct 8, 2006
I have been working for three straight days (and nights!) to accomplish something that is very simple in other languages, but I can't make it work in VB
Column X has, with spaces between 4 possible contents:
3Q
FM
1Q
NM
St1 St3
3Q today
tomorrow
-2
-3
-4
-5
yesterday
FM today
tomorrow
-2
-3
-4
-5
-6
yesterday
1Q today
tomorrrow
-2
-3
-4
-5
yesterday
NM today
tomorrrow
-2
-3
-4
-5
yesterday
3Q today
tomorrow
-2
and so on for 1500 rows.
I can write this in Lotus in about 2 minutes, but VB has me stumped. I hope someone can put me on the corrrect path.
View 8 Replies
View Related
Nov 14, 2008
I trying to do a sheet with one combo box (dropdown list) where I want the user to be able to choose "add rows" to make more boxes appear. My idea to solve this was to put all the boxes in the sheet, and then create a macro that either hides or shows the rows with the extra boxes. Now I have a problem that hiding the rows just does that, and only that. The rows disappear, but the combo boxes stay visible (but ends up on top of eachother).
View 2 Replies
View Related
Feb 5, 2008
what the formula is if I want to hide all rows that begin with: "FORCE-MATCH CANDIDATE" in a specif column. The text after that string varies based on user input.
View 9 Replies
View Related
Mar 22, 2013
I am working on a time management sheet for my company. I need to be able to click a button and have the file search 3 columns for a persons initials and then hide all the rows where the initials are not in at least one of the three columns. I seem to have no problem getting it to work for one column at a time, but as soon as I try to search more than one it all falls apart.
I will also need to create an unhide all button to reset the sheet after the macro has been run.
I have attached a sample of the sheet below. Each project needs to have 3 rows to show the schedule and budget broken down by each team member.
Project Number
Address
Service
PM
SS
[Code]....
View 5 Replies
View Related
Jun 11, 2014
I have a spreadsheet which contains our fleet information covering many vehicles in one list. The teams for these vehicles are listed in Column A. What I would like to have is:
A dropdown box to pick from All, or the various teams in A1To hide every row that doesn't match the selection of A1To reveal every row that contains the selection for A1 at any point in column A. e.g: "*Dog Team*"
This is because something might be listed as "Moved from Dog Team" or "Dog Team, temporarily on loan", or "Dog Team V66.m"
I have taken a small sample of the data I will be working from and made a very simple drop down box which displays the pages of information for the vehicles by hiding/unhiding blocks of columns:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$2" Then
If Range("A2") = "MOT/Service" Then
ActiveSheet.Columns("A:P").EntireColumn.Hidden = False
ActiveSheet.Columns("Q:CE").EntireColumn.Hidden = True
ElseIf Range("A2") = "Contact Details" Then
[Code]....
But because there is also filters on the sheet, meaning the positions of the entries based on rows can change, I need it to search for the "*xyzzy*" method, but am unsure how to do this! While just using the Filters will work, due to some human limitations I have been asked to have a specific drop down box in a very specific location with instructions next to it.
View 1 Replies
View Related
Mar 21, 2014
formula on the attached spreadsheet (Questions UK) I would like the following to happen:
If D3 is YES then rows 91 to 319 hide
If D3 is NO then rows 6 to 89 hide
If D4 is YES then rows 6 to 89 hide and 164 to 319 hide
If D4 is NO then rows 91 to 162 hide
If D5 is YES then row 6 to 162 hide
If D5 is NO then row 164 to 319 hide
View 6 Replies
View Related
Jan 2, 2014
automatically hiding a row(s) based on a cell value.
I have various numbers on column K, rows 12-47.
Example:
k12=680
k13=76.38
k14=0
k15=55.33
k16=0
etc.
In the above example, I would like row 14 and 16 to automatically hide (and unhide if the formula calls for the cell to be greater than 0)
View 5 Replies
View Related
Jan 9, 2009
I would like a macro where I it will examine Cells A8 down to A27 to see if there is a value. If there isn't a value, I want that row hidden. I would like for it to always run (i.e. if a value is put into that cell, the row reappears, otherwise it is always hidden).
View 9 Replies
View Related
Oct 27, 2003
I have a worksheet with an age row of 20 - 99 (and a bunch of other data)
A user enters the starting age, and then the sheet fills in the rest of the cells.
If the user enters 50, the age fills from 50 to 130.
Before printing, I manually hide the rows (using the hide row command) over age 99.
Is there an easy way to do this without macros? I am Excel impaired!
I tried using Auto filter - but I have to rerun the filter each time (it is not automatic).
View 9 Replies
View Related
Oct 15, 2008
I have a couple of excelfiles in which someone made a flowchart with text boxes. I would like a search code that would help me find a text or number in those text boxes. The CTRL+F function only works on cells. Does something similar exist for text boxes? Or can this be made in a macro?
View 9 Replies
View Related
Sep 12, 2007
Trying to Find a specific word and Replace with another within a textbox ( created from the drawing tool, as well as the control toolbar) The textboxes contain loads of text information.
as an example
The word "Apple" to be replaced with "Orange"
I came across this code from the archives (compliments of Dave Hawley)
Sub ReplaceTextBoxText()
Dim sTextBox As Shape
Dim wSheet As Worksheet
Set wSheet = Sheets.Add()
For Each sTextBox In Sheet1.Shapes
I've tried several variations with no results. (perhaps it's to extensive for my modest needs)
View 9 Replies
View Related
Jan 29, 2014
I am in need of a macro to hide worksheets that do not match a certain cell value (which I have range named) in the "input data sheet". If this value matches cell value on the other worksheets, then hide all other worksheets and keep the "valid" worksheet visible
NVS_SCN is the range name that needs to be compared to the value in P4 of worksheets 2 thru 4
Example: NVS_SCN (located on the LANDFILL_DATA wksht) = RC_SOUTHLF
I want the Macro to hide all worksheets except for the South Region LF_VOL_Trend sheet,
if NVS_SCN = RC_MWESTLF then hide all but Midwest Region LF_Vol_Trend
I am attaching a file. I have seen macros to "unhide" or "Hide Rows or Columns" but I am not adept enough to figure out how to utilize range names and hide all but the one I want. As for "recording" the macro, I didn't know how to do the compare part.
View 13 Replies
View Related
May 5, 2009
i have been able to get most of my VB work on my own (i'm learning). Currently I'm having a bit of difficulty in hiding a row based on a cell value, potentially due to cells being merged.
I'd like to select from a dropdown cell to filter on a row's value. Attached you will find a sample sheet that works named "Working" in it's current state and the one "TEST" that does not filter every other line item.
View 3 Replies
View Related
Jun 19, 2009
If Sheet1!A1 = FALSE, I want to hide Sheet2. If the value of Sheet1!A1 changes to TRUE, I want Sheet2 to be visible.
View 2 Replies
View Related
Nov 18, 2011
I am using windows 7, and excel 2007. I want to hide rows bases on a value in cell G2 which is a date field
Example, if G2 is greater than 11/16/2011 then hide rows 1969 through 2032.
View 6 Replies
View Related
Mar 27, 2012
With a piece of code that will hide an entire row if a cell value in that row does not equal the cell value of another row.
Example
Cell d3 = Feb 2012.
Range C5:c252, = a mix of Feb 2012 and Mar 2012.
I want to hide all the Mar 2012.
However if Cell d3 = Mar 2012 then the range C5:C252 will also = Mar2012
I want to see all the rows within that range.
View 4 Replies
View Related
Apr 9, 2014
I am trying to auto hide rows in a spread sheet. the start row will always be 55 and the end row will be 55 + the value of cell A38 in sheet titled "Main".
View 2 Replies
View Related
Sep 14, 2006
I have 2 equation objects created with microsoft equation 3.0. I have named the equation objects Eqn9 and Eqn10. I also have an if function, what i would like to do is if a number in cell AC58 is greater than 0.3 a macro runs and hides Eqn9 and shows Eqn10, similarly if the number in cell Ac58 is less than or equal to 0.3 the macro hides Eqn 10 and shows Eqn9.
View 8 Replies
View Related
Dec 13, 2013
In this example on Sheet 2, I'm trying to hide rows 1-6 if 'E6' is 0, and hide rows 15-26 if 'E18' is 0. These cell values are equal to the same cell in Sheet 1.
I've tried different codes I've found online, but I'm not very experienced with VBA so I can't get it to work. I can get rows 1-6 to hide, but it doesn't do it automatically whenever a zero is inputed into Sheet 1. It only works if I enter something into another cell on Sheet 2.
VB:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("E6") = 0 Then
Rows("1:6").Select
Selection.EntireRow.Hidden = True
[Code]...
View 5 Replies
View Related
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
Jan 16, 2010
I have a command button on a worksheet, not in a user form. I know the command button has a property called Visible that I can manually set to False.
I want to set this property to False if the value of the B3 cell is less than 2.000
View 7 Replies
View Related
Jan 28, 2014
How to hide command button based on another cell?’ [URL] .....
This works faultlessly but for only 1 Button. I tried adding in the code again for a second Button but it creates a conflict. I made a slight adjustment to your original code, to show the button when the cell is populated, which works well…
[Code] .....
Any way I can:-
1. Add additional buttons which reference their own cell?
CommandButton4 – H9
CommandButton6 – I9
CommandButton2 – Q9
CommandButton3 – S9
2. And add one button which activates based on one of 3 cells?
CommandButton1 – J9 &/or V9
View 5 Replies
View Related
Jun 8, 2009
I have the data as follows:
columns B,c,d,e,f,g,h contains data and column A is empty.
What i want is
1. Initially columns c,d,e,f,g,h should be hidden. Only a & b should be visible
2. if i enter a 0 (zero) in A1, then, columns B,c,d,e,f,g,h should remain hidden, for row-1.
3. if i enter a 1 (one) in A1, then, columns B,c,d,e,f,g,h should be visible, for row-1.
View 10 Replies
View Related
Jun 17, 2009
I'm using column A as a reference. My data starts in cell A3.
Whenever theres a zero in any cell in column A I would like that row to hide.
If the row was hidden and the value changes to any number greater than zero I need the row to unhide.
I can record two macros for the hide/unhide part of this but I dont understand how to run them based on cell value.
View 14 Replies
View Related
Jan 16, 2010
I have a command button on a worksheet, not in a user form. I know the command button has a property called Visible that I can manually set to False.
I want to set this property to False if the value of the B3 cell is less than 2.000
View 2 Replies
View Related
Feb 21, 2010
worksheet I am working on at the moment, basically if row 5 has a 0 displayed I want that column to hide, but if row 5 has text of any value displayed I want it to unhide, the range is E5 to BA5 across.
I have draft VBA code as follows:
View 9 Replies
View Related