boolean

  1. JenniferMurphy

    Boolean values are numbers sometimes?

    It appears that Boolean values (TRUE, FALSE) can be used in calculations in some situations, but not others. In this table, Col D shows the formula in Col C. <tbody> R/C C D 4 FALSE C4: FALSE 5 TRUE C5: TRUE 6 TRUE C6: TRUE 7 #DIV/0! C7: =AVERAGE(C4:C6) 8 0 C8: =SUM(C4:C6) 9 2 C9...
  2. W

    Prevent saving workbook

    So I thought if I placed this code into the Workbook Module it would prevent the workbook from being saved or saved as. What did I miss? Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Application.DisplayAlerts = False ThisWorkbook.Saved = True...
  3. K

    Boolean test for dependency between 2 cells

    How can I test whether one cell is dependent on another? I tried the following, but does not seem to work: Function Depends(Cell_B As Range, Cell_A As Range) As Boolean If Not Intersect(Cell_B, Cell_A.Dependents) Is Nothing Then Depends = True Else Depends = False End Function
  4. D

    BeforeSave VBA to move sheet "Done" to new workbook

    We have a workbook, "followup_care.xlsm", in which data is moved to sheet "Done" and we like to move sheet "Done" to a new workbook ,saved with the date in the new workbook name, and both workbooks save and close. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, cancel As Boolean)...
  5. D

    VBA do not allow to save if row count does not match

    Hi, I am looking for a code that would prevent user from saving the file if count of no empty cells in column "E" is different than in columns "F"-"AE" Any ideas?? I tried with below but failed Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If...
  6. C

    Multiple cells to open one userform

    Still relatively new to coding. I'm trying to build an equipment schedule so I know where gear is going/has been. I'm trying to set it up so I can double click the piece of equipment which will in turn run a user form. It works for my first line (A3), but not for anything after. Private Sub...
  7. S

    How to create a Boolean strings in excel with VBA Macro

    Hi Friends, I tried with a formula creating Boolean strings but its time consuming every time. This is an example: In Column, AI have list of words from A1:A50, It varies every time from A1:A50. ColumnB AND words ColumnC NOT words Here I want to build Boolean strings in ColumnD. In ColumnD...
  8. B

    Prevent Save and Save as unless using Macro Button

    Good afternoon! I am trying to set up a Workbook so that using Save or Save As is disabled but Macro buttons that do specific Save As commands are allowed. I have the following code which works well at disabling Save and Save As, but it won't allow macros that are tied to buttons to perform a...
  9. N

    Code error

    Hi, I have these codes in Workbook Private Sub Workbook_SheetActivate(ByVal Sh As Object) Dim ws As Worksheet Set ws = Worksheets("CHIT") If Sh.Name = ws.Name Then ws.Range("C12") = Application.UserName End If Set ws = Nothing End Sub Private Sub Workbook_BeforeSave(ByVal SaveAsUI As...
  10. K

    How to pass a User defined type as a function parameter

    I use VBA all the time but have never tried to use Type. I haven't quite figured it out. Not sure how to pass the parameter into a function. Basically i have a function that i want to call to find a value in a range based on a condition. The condition is a type and based on the type i will find...
  11. kelly mort

    Delete file in a folder with vba or override with new file

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim backupfolder As String backupfolder = "C:\BackupFile\" ThisWorkbook.SaveCopyAs Filename:=backupfolder & ThisWorkbook.Name End Sub Hi, The above code is what I am using to create a backup of my...
  12. S

    VBA Before close

    I'm looking to give users an option when closing a workbook and have put in the following VBA code, but I cant figure out how to trigger the opening of another workbook if 'yes' is selected. Private Sub Workbook_BeforeClose(Cancel As Boolean) If MsgBox("Do you need to refresh timesheets?"...
  13. T

    Changing a boolean string to multiple records (or vice versa)

    I receive an excel file each week that has the race of individuals noted as a single six character Boolean string (e.g., 100000 or 011000 or 000111 etc.). Each 1 or 0 is a "yes" or "no" to the corresponding races. First digit "White", second "African American" etc. As you can see, an...
  14. M

    Error Message when running code, Runtime Error 9, Subscript Out Of Range

    Hi, Can someone tell me why im getting this issue Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If (Sheets("Supplier Checklist").Range("D24").Value) = "No" And Sheets("Supplier Checklist").Range("E21") = "" Then SaveAsUI = False MsgBox "Please define...
  15. S

    Find . . . Using Boolean, Dates, and Wildcards

    I found out how to do this in Win 10 File Explorer: Learning Windows Search: Use Boolean, Dates, and Wildcards to Give Your Searches a Boost . . . https://www.howtogeek.com/school/learning-windows-search/lesson4/ I don't see that that syntax works in Excel 2010's "Find" Do you have to use a...
  16. T

    AMBIGUOUS NAME DETECTED: Workbook_BeforeSave

    Hi guys, I'm new to the forum so apologies if I've already broken a rule/some rules by posting this. I am trying to create an excel for work that doesn't allow the user to save if a cell is blank. Having copied some VBA coding from the internet, I currently have this in the workbook module...
  17. L

    Bold is Variant not Boolean

    Hi Excel define Bold as a variant. Yet the example below (from https://docs.microsoft.com/en-us/office/vba/api/excel.font.bold) Assigned True to Bold!! So why excel did not define Bold as a Boolean? It would make sense to be define as Boolean. Thank you. what does it mean a variant variable...
  18. D

    How to return the SUM of several multi-criteria INDEX/MATCH results?

    Simplifying as much as possible, my data is structured as below. What I'm trying to return is the sum from one of the component cost columns of table 2, of entries that are "X" category and "TRUE" boolean from table 1. In the example below, the sum for "X" category, TRUE should return $4.00...
  19. S

    Save As Cell content

    I currently have the Save blocked to where you can only do a Save As. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If Not SaveAsUI Then Cancel = True End If End Sub But I also am wanting when you go to Save As it will have the contents from...
  20. D

    Posting a Range

    Hi I hope you can help. I have a range of cells on one sheet - this range can change depending upon contents. So, For example, the entire range is between cells B19 and G31 I am thinking - if I copy this range to an Array then how do i tell the array that I don't want blank cells when I copy...

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top