Re: Unhiding Sheet based on the result of cell IF formula
Just tried this approach, and it works when F3 goes from Yes to No, until I uncheck one of the checkboxes, sheet 2 remains visible, any ideas??
Re: Unhiding Sheet based on the result of cell IF formula
Just tried this approach, and it works when F3 goes from Yes to No, until I uncheck one of the checkboxes, sheet 2 remains visible, any ideas??
Re: Unhiding Sheet based on the result of cell IF formula
Thank you sir, for your time and assistance, however, the order of events are as follows, the CheckBoxes are checked first, for instance CB3 would be "Does NOT effect others" CB4 would be "Is NOT Recordable" then those CBs would require signature sign off (via userform and password) and the date that the evaluation was made.
In that order, the checkbox would have to be "rechecked" in the code you gave above, after all conditions were met, my apologies for the lack of communication.
Hello gurus, I am trying to unhide a sheet when 6 conditions have been met, I'm using an IF formula to return "Yes" or "No" when those conditions are met. Explanation of conditions that must be met in the attached workbook...Cell D2 is the sum of CheckBox 3 & 4, there must be a name in A7 & A9, there must be a date in B7 & B9. F3 is the result of the Formula. I cannot seem to get the code working, if you have a better approach at what I'm trying to accomplish, by all means post it up.
I have tried the following in the worksheet...
Private Sub Worksheet_Calculate()
If Me.Range(F3) = "Yes" Then
Sheets("Sheet2").Visible = True
Else
Sheets("Sheet2").Visible = False
End If
End Sub
I have tried the following in the workbook
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Worksheets("Sheet1").Range("F3").Value = "Yes" Then
Sheets("Sheet2").Visible = True
Else
Sheets("Sheet2").Visible = False
End If
End Sub
Display More
Any and all suggestions greatly appreciated.
Joe
Admins, my apologies, I should have created this in the Excel VBA/Macros section.
Re: How to create an email with the receipents being from an advance list?
Not sure how to auto populate the To: within the code, if thats what you're asking.
The way I use this, I type the email addresses between the "", when the code runs, those email addys are auto placed in the To: portion of your Email client.
Re: Stop Userform show when searching Usedrange
I have it Figured out...forgot the Application.EnableEvents false and true
Thanks
I have the following code that "beforesave" searches the document and locks the cells that has data, and leaves empty cells unlocked. When save is clicked the userform shows. The useform is triggered by "worksheet selection change" cells B21 and B23 show userform2 and cell B37 userform1. How do I stop the userform from showing when the save button is clicked. I greatly appreciate the help and lesson. I can post the code for the userform if needed as well.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)Dim rng1 As Range
Dim rng2 As Range
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If ActiveSheet.Name = "Dept1" Then 'change name of sheet as needed
'Resume to next line if any error occurs
On Error Resume Next
Dim cell As Range
With ActiveSheet
.Unprotect Password:="open"
For Each cell In ActiveSheet.UsedRange
Set rng1 = Intersect(Cells.SpecialCells(xlFormulas), Cells.SpecialCells(xlBlanks))
Set rng2 = Intersect(Cells.SpecialCells(xlConstants), Cells.SpecialCells(xlBlanks))
ActiveSheet.UsedRange.Locked = False
If Not rng1 Is Nothing Then rng1.Locked = True
If Not rng2 Is Nothing Then rng2.Locked = True
Next cell
.Protect Password:="open"
End With
Application.Calculation = xlCalculationAutomatic
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End If
End Sub
Display More
Re: Locking Merged cells before save
For those looking for the working code, here it is...Thank you ASHU1990, couldn't have done it without you.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)Dim rng1 As Range
Dim rng2 As Range
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If ActiveSheet.Name = "Sheet1" Then 'change name of sheet as needed
'Resume to next line if any error occurs
On Error Resume Next
Dim Cell As Range
With ActiveSheet
'First of all unprotect the entire sheet
.unprotect Password:=""
'Now search for non blank cells and lock them and unlock blank cells
For Each Cell In ActiveSheet.UsedRange
Set rng1 = Intersect(Cells.SpecialCells(xlFormulas), Cells.SpecialCells(xlBlanks))
Set rng2 = Intersect(Cells.SpecialCells(xlConstants), Cells.SpecialCells(xlBlanks))
ActiveSheet.UsedRange.Locked = False
If Not rng1 Is Nothing Then rng1.Locked = True
If Not rng2 Is Nothing Then rng2.Locked = True
End If
End If
Next Cell
'Protect with blank password, you can change it
.Protect Password:=""
End With
Application.Calculation = xlCalculationAutomatic
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End If
End Sub
Display More
Re: Locking Merged cells before save
A little info on this form, this form goes around the office to several different users, we do not want users editing someone elses remarks. The first user will initiate the form, that data needs to be uneditable by the next user and so on.
The VP of Quality will hold the password for changes deemed necesssary.
I have a QC form that contains merged cells, I am not allowed to change the form. I need to lock the cells after data entry when saving, I have the following...
Option ExplicitPrivate Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim i As Long
Dim j As Long
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.DisplayAlerts = False
If ActiveSheet.Name = "Sheet1" Then 'change name of sheet as needed
'Resume to next line if any error occurs
On Error Resume Next
Dim Cell As Range
With ActiveSheet
'First of all unprotect the entire sheet
.Unprotect Password:=""
'Now search for non blank cells and lock them and unlock blank cells
For Each Cell In ActiveSheet.UsedRange
i = Cell.Row
j = Cell.Column
If Cell.Value <> "" Then
If Cell.Locked = False Then
Cell.Locked = True
End If
End If
Next Cell
'Protect with blank password, you can change it
.Protect Password:=""
End With
Application.Calculation = xlCalculationAutomatic
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End If
End Sub
Display More
In the attached file I have highlighted the cells that would require input, the highlights will return to "no fill" once the form is working.
Password is blank for now.
Thanks in advance for your help,
Joe
Re: Send E-mail based on Non-contiguous cells using SUB Button Clicl()
Awesome...Thanks S O...works perfectly!
[INDENT]I have the following working code, I only need one E-mail if any or all of those cells are >0, instead of the 7 if all the cells are >0...I have tried to compile this code
[/INDENT]
If Worksheets("Tool Room List").Range("G546") > 0 Then ActiveWorkbook.SendMail Recipients:="jsmith@xxxxxxxx", Subject:="Tool Request", ReturnReceipt:=False
If Worksheets("Tool Room List").Range("G591") > 0 Then ActiveWorkbook.SendMail Recipients:="jsmith@xxxxxxxx", Subject:="Tool Request", ReturnReceipt:=False
If Worksheets("Tool Room List").Range("G593") > 0 Then ActiveWorkbook.SendMail Recipients:="jsmith@xxxxxxxxxx", Subject:="Tool Request", ReturnReceipt:=False
If Worksheets("Tool Room List").Range("G594") > 0 Then ActiveWorkbook.SendMail Recipients:="jsmith@xxxxxxxxxx", Subject:="Tool Request", ReturnReceipt:=False
If Worksheets("Tool Room List").Range("G595") > 0 Then ActiveWorkbook.SendMail Recipients:="jsmith@xxxxxxxxxx", Subject:="Tool Request", ReturnReceipt:=False
If Worksheets("Tool Room List").Range("G630") > 0 Then ActiveWorkbook.SendMail Recipients:="jsmith@xxxxxxxxxx", Subject:="Tool Request", ReturnReceipt:=False
If Worksheets("Tool Room List").Range("G631") > 0 Then ActiveWorkbook.SendMail Recipients:="jsmith@xxxxxxxxxx", Subject:="Tool Request", ReturnReceipt:=False
[INDENT]
into this..
If Worksheets("Tool Room List").Range("G546,G591:G595,G630:G631") > 0 Then ActiveWorkbook.SendMail Recipients:="[email protected]", Subject:="Tool Request", ReturnReceipt:=False
But as you experts know, it doesn't work,
Thanks in advance for your assistance,
Joe[/INDENT]
Re: Send Email based on a single cell value using Sub button click()
Quote from S O;738811Hi jsmith2043, can you post this in a new thread please? You're nearly there with the fix but it's technically a different topic from the original query and so we would use a different thread for the sake of keeping the search facility clean within the forum
Absolutely...Thanks
Re: Send Email based on a single cell value using Sub button click()
My list has grown over the last few months, and I've had to add more cells to act upon, what I've tried to do is compile this...
If Worksheets("Tool Room List").Range("G527") > 0 Then ActiveWorkbook.SendMail Recipients:="jsmith@xxxxxxxxxxxx", Subject:="Tool Request", ReturnReceipt:=False
If Worksheets("Tool Room List").Range("G591") > 0 Then ActiveWorkbook.SendMail Recipients:="jsmith@xxxxxxxxxxxx", Subject:="Tool Request", ReturnReceipt:=False If Worksheets("Tool Room List").Range("G593") > 0 Then ActiveWorkbook.SendMail Recipients:="jsmith@xxxxxxxxxxxxxxxx", Subject:="Tool Request", ReturnReceipt:=False
If Worksheets("Tool Room List").Range("G594") > 0 Then ActiveWorkbook.SendMail Recipients:="jsmith@xxxxxxxxxxxxxxxx", Subject:="Tool Request", ReturnReceipt:=False
If Worksheets("Tool Room List").Range("G595") > 0 Then ActiveWorkbook.SendMail Recipients:="jsmith@xxxxxxxxxxxxxxxx", Subject:="Tool Request", ReturnReceipt:=False
If Worksheets("Tool Room List").Range("G630") > 0 Then ActiveWorkbook.SendMail Recipients:="jsmith@xxxxxxxxxxxxxxxx", Subject:="Tool Request", ReturnReceipt:=False
If Worksheets("Tool Room List").Range("G631") > 0 Then ActiveWorkbook.SendMail Recipients:="jsmith@xxxxxxxxxxxxxxxx", Subject:="Tool Request", ReturnReceipt:=False
The above works, however if all of those cells are greater than 0, I get 7 Emails...I want to get only one if any or all of those cells are >0
I tried the following...
If Worksheets("Tool Room List").Range("G546,G591:G595,G630:G631") > 0 Then ActiveWorkbook.SendMail Recipients:="[email protected]", Subject:="Tool Request", ReturnReceipt:=False
But as you experts probably already know...it doesn't work.
I realize this is not the original thread topic ,and I will create a new one if required...
Thank you in advance for the assistance!
Joe
Re: Send Email based on a single cell value using Sub button click()
Thanks, S O....works great!
Re: Send Email based on a single cell value using Sub button click()
Thank you for the quick reply, getting Subscript out of range, I have attached the copy of the file through dropbox (its a large file). the code is in module 1http://"https://www.dropbox.com/s/99tm12uumwjhnfw/Master%20Tool%20List%20%20Latest%20Revision%20%284%29.xlsm?dl=0"
The following code works flawlessly, I need to add a condition to sending the Email. If cell G527 in worksheet (Tool Room List) contains a number greater than Zero, then send the Email, if not or isblank do nothing. They way the code is below, it will send an email regardless.
The email code is near the bottom of the code below
Thank you in advance for your help.
Sub CopyData()Dim k As Long, v As Long
Dim copyRange As Range
Dim dataSet As Variant
Dim wsReport As Worksheet
Dim ws As Worksheet
Dim lastRow As Long
On Error GoTo ErrHandler
Application.ScreenUpdating = False
Set ws = Worksheets("Tool Room List")
Set wsReport = Worksheets("Report")
wsReport.Select
v = Cells(Rows.Count, "A").End(xlUp).Row + 2
If v = 1 And Range("A1") = vbNullString Then
Else
v = Cells(Rows.Count, "A").End(xlUp).Row + 3
End If
Worksheets("Report").Unprotect Password:="open"
newReportStart = v
ws.Select
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
For k = 14 To lastRow
If Range("G" & k) > 0 Then
Set copyRange = Range("A" & k & ":M" & k)
dataSet = copyRange
wsReport.Select
Range("C" & v) = dataSet(1, 1)
Range("B" & v) = dataSet(1, 3)
Range("A" & v) = dataSet(1, 4)
Range("D" & v) = dataSet(1, 7)
Range("H" & v) = Format(Now, "mm/dd/yy hh:mm")
Range("G" & v) = dataSet(1, 11)
v = v + 1
End If
ws.Select
Next
wsReport.Select
'sort the data
Range("A" & newReportStart & ":E" & Cells(Rows.Count, "A").End(xlUp).Row).Select
Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
setborder
Application.ScreenUpdating = True
Exit Sub
ErrHandler:
MsgBox "The Error Number is - " & Err.Number & ": " & Err.Description
MsgBox "Unable to continue"
End Sub
Sub setborder()
Worksheets("Report").Select
Columns("A:A").ColumnWidth = 45.43
Range("A" & newReportStart & ":H" & Cells(Rows.Count, "A").End(xlUp).Row).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.Weight = xlThin
Worksheets("Report").Protect Password:="open"
End With
ActiveWorkbook.SendMail Recipients:="[email protected]", Subject:="Tool Request", ReturnReceipt:=False
End Sub
Display More
Re: Calculate percentage decrease
I have uploaded a file for you to evaluate....C11 is the number you want to add or subtract a percentage from....E5 is the + or - % (make sure you have the percentage sign behind the number)ie -50%... or to add percent 50%...G11 is the result
Hope this helps...
Re: Filter Sheets using Criteria from Drop Down Box
Thanks Herbds7...Now I will attempt to get this into my project....
Thanks Again,
JS