Boolean Function To Return Whether PC Is Connected To Internet?
Jun 6, 2013
I want a boolean function to return whether the PC is connected to the Internet. How to start creating this.
Reason:
I have code that checks an online database and downloads data after the user presses a button.If the host computer is not currently connected to the net, I would like to display a message of my choice instead of trying to run the code.To determine whether to run my message or not, I need a function that will return TRUE/FALSE if the host PC is net connected or not.
I have created an application for users that requires the user be connected to the network. I wanted to do a check to see if they are connected, and if the user is not connected they would get a message box telling them that they need to be connected to the network, then the workbook would close. Below is the code I have, but when a user is not connected they do not get my messagebox, instead they get the excel error message "excel run-time error '52': bad file name or number", and the debugger line that gets highlighted is in the function DirExists that checks the length of the directory of the file path: Len(Dir(strpath))
Option Explicit Function DirExists(strpath As String) As Boolean If Len(Dir(strpath)) = 0 Then 'this is where the debugger highlights DirExists = False Else DirExists = True End If End Function
Private Sub Workbook_Open() Dim strpath As String Dim strfile, strfile2 As String strpath = "\n530fs1PCLFileSharespcl_repositPricing_ToolsPAT" If Not DirExists(strpath) Then............................
I have an excel assignment that has about 4000 orders for wood. I am suposed to find the company that ordered the most wood and of what kind. I am really at a loss for how to do this and have combed over my book quite afew times trying to figure it out. However it has little if any excel info and nor does the ** that came with it outside of how to install data analysis tools. I figure I need to find a way to get excel to combine the numbers together for orders from the same company but after trying for afew hours I have gotten no where.
I have a workbook with several columns, some of which are for internal company use only.
Sometimes we need to send an updated list to business partners, but they don't need all columns.
Is it possible to make another workbook which takes only specific columns, and excludes the stray info at the bottom of the original workbook? See examples.
Alternatively: Would it be simpler to make an extra sheet in the original workbook, and somehow choose "Safe only this sheet to a new document" whenever someone requests the list?
Situation: I need to calculate a lot of averages of non-connected values. That is, they are separated by several rows (which also contain values). So far, I use the code-sample below (just to illustrate), which is not really elegant. Unfortunately, it seems that this technique comes to its limits when a high number of different non-connected values are combined into one string and get assigned to a formula- range (last line of code), which is where the program stops.
My question is: Is there a nice way to solve this? A way, which is not limited by the amount of data processed? The only way I could think of, would include a UDF, where a sum, sums all values up and then devides by the number of added sums ... but this would be relatively slow, and I have an awful lot of values to be averaged (100 sets * 6 rows * 200 values = 120.000 calculation- steps), as well as STDEV and a Standard Error of Mean (SEM) to calculate. Is there a better alternative?
Const intCells=9 'actually, this is no constant but a variable Const i=4 'actually, this is no constant, but a nested for- loop-value Const intLinesInBetween = 12 ' amount of lines, which separate my values Dim j As Integer 'simple counter, runs through all cells Dim rngUpperRow As Range 'Range of the upper row = normalized time vector Dim rngCurrentRowAvg As Range 'current row into which avg formulas are inserted Dim intCells As Integer ' amount of experiments in range............
I am seeking some code that will check that the PC / Laptop has an online ethernet connection via it's NIC (Network interface card). I want it to output to the spread sheet to a Conditional cell (Connected / unconnected).
Is there any way to have a web query stay connected and get live data from a site while still being able to use excel at the same time?
Basically the site has information that changes by the second and i need to keep a running record of it, and when it hits the variables needed i want to be able to trigger a set of code.
I have a timecard spreadsheet which im working on, each employee is represented by a single worksheet in the workbook, and the worksheet is named after the employees name. New employees are added by filling in a form which dynamically creates the timecard based on a template. Im trying to impliment a 'Fire Employee' button which sits on each employees sheet and can be clicked to set an employees working status to false by changing a boolean variable called 'fired' to true.
Ive been looking around the forum but I cant figure out if i should be using public variables or where exactly i should be placing them, so that each employees 'fired' status is set to false when the worksheet is first created, but can be set to true when the 'Fire Employee' button is clicked, this must only set true for that specific employee, and not all employees. If your wondering why i need this, the employees work status will be used on other forms to toggle views etc so thats why a boolean approach is best (at least i think it is if its not to difficult to do)
I have a couple of points, and when i do a scatter plot with connected by smooth line plot, it seems like excel does a bezier splines interpolation. I am wondering am i able to extract the data plots from the data chart?
for example if i have
X - Y 0 - 5 180 - 0 360 - 5
I would like to have all datas of Y from X (0 - 360 degree every degree).
I have minimal excel knowledge, but enough to get by. I have 2 years in C++ programming.
Here's what I'm trying to do:
I'm trying to create a workbook to keep track of flags we send out, and receive back. We have a lot going and coming, so I figured the best way to do this would be to break down each region on different sheets. But I need to create a check box that says something like, "Yes/No" or "Here/Gone" or something like that. THEN, I need to take that information, and put it on the front sheet of the workbook so I know how many we have in/out total. Does this make sense? I know how I would program this in C++, but excel is a bit different.
once bTest is declared as a Boolean, it becomes equal to FALSE (I checked this after much head scratching). How does one assign a value to a boolean variable only after you make your test.
Sub foo()
Dim bTest As Boolean
If Range("a20").Value = False Then bTest = False '
I need help creating a code that does the following:
I want a Boolean variable (TheTD) to be True when and only when the value in cell A1 is "TwoOnly". Once it isn't then I want the Boolean to be immediately False. Once cell A1 is "TwoOnly" I want TheTD to be true immediately as well.
I am using a userform and the textbox1_Change macro can change the value of cell A1 while typing. So in other words The Boolean can be changed from True to False multiple times depending on what I type in textbox1.
I would like to construct in VBA "n choose r" Boolean arrays of length n which will give all possible combinations of these variables as you scroll through the arrays.
Typical values of n and r would be 40 and 5 respectively and I'm looking to get the fastest possible output on these 660,000 or so arrays.
I have been playing around with various "for, to" statements but haven't managed to turn out anything meaningful thus far.
I now have XL 2007 but no longer work at the same place so do not have access to the external data source. I would like to view the SQL statements that I wrote back then but keep getting error that I am not connected to external data source and so cannot see my sql statements. I have MS Query 2007.
I have cells in my Excel sheet that contains boolean values, ie. the values TRUE or FALSE. Is it possible to format these cells so that FALSE is written with red color?
Seems like this one should be pretty easy but I'm stuck... I just want to return a boolean based on whether the currently active cell contains the character "#". I've been trying to use the find method but I can't figure out how to convert a match or lack of a match to a boolean.
I have strings in cell a1. I will put a formula in a3 if string "xyz" is found inside a1, it will show value from a2, else shows nothing.
i tried simple formula cell a3 =if(a1="xyz",a2,"") here it is exact match, i need partial match, or multiple partial match in a single cell. How to do it?
i need someone that can think through this boolean logically. its been a long day at work and now I'm trying to walk through this boolean thing to make sure my data will post on the right pages.
I have an Excel Macro that will capture inputted customer/vehicle data from an input screen, at the end, based on questions answered, i need to place that data on 1 of 4 sheets in my excel document.
The questions are: Is this a Nationwide claim? (Y.N) (boolean = nw) Is the vehicle here? (Y/N) (boolean = vh)
So here's what i got if NW = true and VH = True then place data on "sheet1" if NW = true and VH = False then place data on "Sheet2" if NW = False and VH = true then place data on "sheet 3" if NW = false and VH = False then place data on "sheet4"
I can't think of how to write this IF statement for this to happen. can't get the logic going.
I'm trying to figure out how to reorganize data based on boolean values in two different columns. My goal is to write something in VBA that will look to see if the boolean in the first cloumn is true then procede to check if the boolean in the next column, same row is true. If that is the case, it will take several values from the row and move them to another worksheet. If the boolean in the first column is true, but the second column is not, it will look down the rows of the second column until it finds true then move several values from rows it has passed through. Here is an example of the sample data I will be dealing with.
Date Time Duration Boolean1 Boolean2 6/22/200715:0032TRUETRUE 6/22/200718:0058TRUEFALSE 6/22/200719:0060FALSEFALSE 6/22/200720:0060FALSEFALSE 6/22/200721:0060FALSEFALSE 6/22/200722:0060FALSEFALSE 6/22/200723:001 FALSETRUE
Based on the example data my goal is to move the data in a new worksheet that would look something like this
Date Start End Duration 6/22/2007 15:28 16:00 32 6/22/2007 18:02 23:01 299
I am trying to return a TRUE or FALSE based on a date in a cell.
for example:
if cell A1 = 07/11/2009
I want A2 to show TRUE or FALSE if A1 is 14 days or more behind todays date.
I have tried stuff like:
=IF(A1=TODAY()-14,"True","False")
but it just always says false. EDIT: I have just noticed that if I change the date in A1 to exactly 14 days behind todays, it returns TRUE. So, it does work. Do I need to add a GREATER THAN in there?
This macro adds a comment to a cell and some text from an input box. I store the last value entered in the input box via the registry, it is recalled as the default input box value. How do I capture the cancel property (Boolean, true or false?) so the ActiveCell.Value remains and comment is not added? When a user selects Cancel/X the macro deletes the value in the cell and add's a comment. This overwrites existing data with "" (nothing).
I am attempting to pass a boolean variable between two macros. The SUBMIT macro calls the STATUS macro to do some verifications and the STATUS macro should return the boolean variable RDY back to the SUBMIT macro, but does not.
I am using Excel 2007. Both macros are in the same Module. The STATUS macro is called from several places in the code.
Public Rdy As Boolean Sub Submit() [code] Call Status If Rdy=True then msgbox("You have completed your form") else msgbox ("Not ready") [code] end sub
Can I use dates as argument in Boolean arithmetic? I have a list of name with their date of birth and I would like to tell who is between 18 and 25. It's easy enough with number but with dates? Excel 2007
I have a function that works well for checking if a specified file exist within a specified path. I realized I do not know how to just check if the folder exist!
Example: I want to see if the following folder exist with boolean response...