Check User Name

May 31, 2006

I am using the following code which works fine:

'Checks user name before opening
UN = Environ("USERNAME")
If UN = "lemons" Then
Sheets("Title").Select
Range("a1").Select

Else
ActiveWorkbook.Close
End If

But when I change the code to check for more than on user as shown, I am getting a complile error.

'Checks user name before opening
UN = Environ("USERNAME")
If UN = "lemons" Then
Sheets("Title").Select
Range("a1").Select

If UN = "LEMONS" Then
Sheets("Title").Select
Range("a1").Select
Else
ActiveWorkbook.Close
End If

I need to add or a better way to check the user name

View 3 Replies


ADVERTISEMENT

Check A User Input To See If The User Has Entered The Date Correctly

Feb 17, 2010

I am trying to check a user input to see if the user has entered the date correctly. I am using the code below but it keeps giving me a "Type Mismatch" error.

View 2 Replies View Related

[User Forms] Check Box Is Highlighted?

Feb 28, 2009

My problem is trivial but annoying. When I initiate my user form, one of the check boxes has a dashed border around the outside as if it was selected. No matter what I try, I cannot get the form to initialize without effecting this box. If I delete the box and recreate it, another box simply inherits this problem.

I have attached the spreadsheet, please Click the button over "A1" to see what I mean if you have the time.

View 2 Replies View Related

Check Before Pasting User Input Information

Mar 19, 2009

i am writing a program that asks the user for an input and sets it equal to a variable.

i want to look thru a column for this variable, if it is not in it, then paste it at the end of the column. if it is in already, throw up a dialog box saying its already used and exit the sub.

i dont know how to set up this kind of thing up???

vlookup in combination with an if statement?

View 6 Replies View Related

How To Check For User Interaction Whenever Change Detected

Mar 9, 2013

I was told that the following code would enable my macro to execute every time the user interacts with anything Excel:

Code:
' Repeatedly check for user interaction whenever a change is detected
Private Sub Worksheet_Change(ByVal Target As Range)
Call TestMacro
End Sub

It doesn't work...

To put it into context, he is my entire program:

Code:
Sub TestMacro()'
' TestMacro Macro
'
' Create string variable
Dim undoText As String
' Assign the text to string variable

[Code] ......

My being new to VBA doesn't work in the situation as my programming instincts tell me to set up an infinite loop to continually check for interaction something like the following:

Code:
while( x == 1 )
{
do MY_CODE;
if( USER_CLOSES_EXCEL )
x == 0;
} // end while

However, Excel is apparently 'Event Driven' so I'd love to know how to use this to my advantage in keeping my macro running.

View 2 Replies View Related

Before Close Event (check User If They Logged Out?)

Jun 6, 2008

I am trying to ask to the user to check if they logged out when they close the workbook but my code is not working...

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Sheets("OD&D Log-in").Select
If Range("H5") = "reconcile" Then
a = MsgBox("Do you want to Log-Out?", _
vbYesNo)
If a = vbNo Then Cancel = True
If a = vbYes Then
Sheets("OD&D Log-in").Select
Else
Workbooks("Daily OSD Log (ver5).xls").Close SaveChanges = True
End Sub

View 9 Replies View Related

Check Which User Has File/Workbook Open

Jul 28, 2004

I have a program that opens an excel-workbook, I first check whether the file is opened by another user(open for read-write). This works fine, but I'd like to know which user has the file open with VBa code. ex.

workbooks.open ....
if open
then msgbox " Book opened by user"
end if

So it's the same as you open an excel(with your windows explorer) on a network and you get the message that the file is already opened by the user....

View 2 Replies View Related

Array To Check User Input Match

Feb 22, 2007

This is what i want to do: SEE ATTACHEMENT

•Write codes to pop up an InputBox to ask the user for a customer name.

•The program uses the user’s input to check whether the name is on the list. If it is, display an msgbox saying that the customer name is on the list, and the corresponding cell will be indicated in boldface and in blue. Otherwise, an msgbox will be displayed saying that the customer name is not on the list.

Dim the customer list as an array (string var. type) and Dim Found as Boolean. You will need the If-Then construction and For-Next or Do-While/Until loop too). Create a button to run and another to restore the formatting to its original style.

This is what i did so far and still having problems with it:

Option Explicit

Sub customers()

Dim Arr()
Dim R As Integer
Dim C As Integer
Dim ReturnColumn As Boolean

View 6 Replies View Related

Collect Date From User & Check If Valid

Aug 31, 2007

want to do something simple, and it just wont paste. not sure why. anyone care to look it over and tell me what i'm doing wrong here?

'Insert Date Information
Dim vDate As Date
Range("D2").Select
ActiveCell.FormulaR1C1 = Date
vDate = Date

'Get date from user
Dim dDate As Date
vDate2 = Application.InputBox(Prompt:="Type in the due date for the location." _
& Chr(13) & Chr(13) & "*If you want the date to default to " & Date + 5 & " then leave the field blank.", _
Title:="Due Date", Type:=1 + 2).............

View 3 Replies View Related

IsBlank In VBA: Check That Makes A User Insert An Integer Between 0 And 90

Aug 28, 2009

Trying to design a check that makes a user insert an integer between 0 and 90. So far I can use this:

View 3 Replies View Related

Check If Speadsheet Already Open In Network Drive By Another User?

Jul 28, 2012

I want a simple VBA code that when run will check if a particular spreadsheet that exists on a Network Drive is already open or not by another user. Imagine there are 3 users A, B & C

The network path for example is : S:Department1TeamAConsolidated Report"

The spreadheet name is : Consolidated Database.xls

If the spreadheet that is on S:Department1TeamAConsolidated ReportConsolidated Database.xls is already open by User A then User B should get a message that "File is already open"

I have the below code which I got from a website which I kind of tweaked but it doesnt work.

Dim WbookCheck As Workbook
On Error Resume Next
Set WbookCheck = Workbooks("Consolidated Database.xls ")[code]......

View 5 Replies View Related

Check User Input To Prevent Run-Time Error

Dec 28, 2007

what I want. It relies on an input box asking the user to enter a part code, which when found creates a duplicate copy. However, if the user enters a part that doesn't exist I get a run-time error. Can anybody point me in the right direction so when a user enters an incorrect part they get a message telling them it doesn't exist.

Private Sub SortTest_Click()
Dim s As String
Dim r As Excel. Range

Range("A2").Activate
s = InputBox("Enter the number you wish to find")
If StrPtr(s) = 0 Then
MsgBox "You must enter an existing part number!"
Else
Set r = Cells.Find(What:=s, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)

Range(Cells(r.Row, "A"), Cells(r.Row, "AH")).Copy
Sheets("APL").Cells(r.Row, "A").Insert Shift:=xlDown


Application.CutCopyMode = False
Application.Goto Sheets("APL").Cells(r.Row, "H")
Selection.Offset(-1, -5).ClearContents
Selection.Offset(-1, 0).Select
End If

End Sub

View 7 Replies View Related

Userform With Remember Password And User Id Option Or Check Button

Sep 12, 2009

I have userform in excel which asks user to enter user id and password. I want a to have "Remember Me" check button on my userform which will remember user details and he wouldn't have to enter user id and password again and again.

View 14 Replies View Related

Search Through Rows In Array And Check If There's No "text" In It Like User Inputed In Box

Apr 17, 2009

the task for the code below is to search through rows in array and check if there's no "text" in it like user inputed in box. But it always shows that there's no such email,i can't figure out the mistake, Maybe the problem is in the type the InputBox returns? But i've tried entering type := 2 (text),dunno what else i can do...I've also tried using p = InputBox("Please,eneter email!").

View 2 Replies View Related

Making Excel File Accessible For Few Users But One User Should Not See Other User Entries

Jul 11, 2012

I have an excel file with multiple sheets. I want my HR team to update that file, but one user shouldnt see the entries of other users. I want to make a consolidated file out of three files. This excel template is for salary input.

View 3 Replies View Related

Prevent The User From Saving The Data Input From The User Form If Any Of Those Three Fields Is Left Blank

Feb 9, 2010

I have a user form that has a combo box "City" two text boxes one called "Flight" and the other "Date". What I'm trying to do is to prevent the user from saving the data input from the user form if any of those three fields is left blank. The code that I have so far checks all of the required fields, if any are left blank a message notifys which field(s) is left blank and return the focus back to that field. But the rest of code also fires.

What I really need is either to stop the code if any fields are blank and return the focus back to the blank field, the user completes the field(s) and clicks the save again, or better yet, pause the code until all the required fields are completed and then complete the save. (There is actually another 200+ lines of code in this sub, but I deleted it to keep the post a little shorter.)

View 2 Replies View Related

Exl2K User: Sheet Is Password Protected But User Can Change Color In Unlock Cells

Jun 16, 2006

find attached zip file . if you open the file then you can understand the problem.

I need to change cells color and text color as per user choice in Password protected sheet : (user is useing excl2000)

Kindly open attahced file i putted the note inside the file.

View 3 Replies View Related

Macro To Force Format And Check Barcode Check Digit

Nov 27, 2009

My company uses 4 types of barcodes 8, 12, 13, & 14 number barcodes for our products my problem is that I can't figure out how to force the barcode to format properly no matter how somebody enters it if they don't use spaces or put them in the wrong spots, I can't use custom formats because there is 4 different layouts

8 digit should be "#### ####"
12 digit should be "###### ######"
13 digit should be "# ###### ######"
14 digit should be "# ## ##### ######"

these barcodes are in columns L, M, & N also right now 'm using a formula in another cell to verify the barcodes by calculating the check digit and comparing it to the check digit typed the formula i'm using is

View 9 Replies View Related

VBA Check If A Cell Is Empty - Move 7 Cells Over And Check Again (Loop)

Aug 10, 2012

I have data in Row 53 that spans 7 columns, but stays in the same row. I want to design a loop to select every 7th cell in that row and check if it is empty. If not, add onto a "counter" then display the final number of occupied cells (the value of the counter) at the end. This is what I have so far, but I get all sorts of errors.

Code:
Sub Tester()

Dim WB As Workbook
Dim WS As Worksheets
Dim modCounter As Long
Dim Cell As Range

Set WB = Workbook("Transverse Series.xlsm")
Set WS = WB.Sheets(BM18)

[Code] ......

View 1 Replies View Related

Prevent User From Accessing The Excel File When It Is In Use By Another User

Jul 22, 2013

An Excel file named CLEARING is availble in thr central server system. it will be accessed by 5 or 6 staffs from some other systems what i need is when one person accesses/edits this file the others should not even able to open in the read only file ,when the file is saved and closed ,then only the next person should access it

View 1 Replies View Related

Logon Box - User / Pass - Unique Actions Per User.

Apr 2, 2009

I have a workbook that is used to track overtime hours worked through the year. I've received some help from users on this forum, and others, to create the necessary macros and formulas to allow a supervisor to make use of the form; however, the workbook is also used to track those that wish to volunteer to work overtime each weekend. The sheet has a list of names for the employees on each shift, then a column to allow a "Y" to be placed under the date - designating them as a volunteer for any overtime available. I've found this spreadsheet (attached - from this site) that will allow individual users to access the workbook and have unique passwords for each. I don't completely understand how it works, but I feel it may be a start to getting what I want.

Essentially, once the user selects their name and inputs their password, I'd like the workbook to be opened and then allow them to only manipulate the row associated with their name. That row will change from week to week, so specific numbers will not be able to be used, but their name will be the same as the name used in the logon.

I feel like I'm asking for a lot here, so just some initial guidance on whether this type of thing is possible would be an acceptable answer.

View 9 Replies View Related

VBA Spell Check - Dont Ask To Check Rest Of Doc?

Nov 3, 2008

I am using this code

View 5 Replies View Related

Check Box Controlling Other Check Boxes?

Jul 4, 2014

I want to have 1 check box affect 3 others in the following way: check box 1 if checked, allow check/uncheck of check boxes 2, 3, 4 if unchecked, uncheck boxes 2, 3, 4 and do not allow checking check box 1 is linked to D1 which starts with a value of false. cell E1 is if condition to have value 1 when D1 has value of true.

I have attempted to attach an example worksheet.

Test check control.xlsx

View 1 Replies View Related

Check All Check Boxes With CheckBox

Sep 9, 2007

I am creating a userform with 10 checkboxes. The first 9 checkboxes are user options. I want the 10th check box to be a "Select All" option i.e. if the 10th checkbox is checked all the other 9 options are deemed to have been selected.

The way I want the display to work is that if the 10th checkbox is ticked all other checkboxes are cleared. Also if the 10th checkbox is ticked and any of the other check boxes is selected then the 10th checkbox should be selected.

I have tried coding this up but the checkboxes don't seem to operate as desired. I placed some code on the click event for the last option button to set the vlaue for all other buttons to false. This works but the 10th check box doesn't get ticked itself. When I try to code up the other bit I get similar issues.

View 9 Replies View Related

User Forms- Create A User Form That Will "pop Up"

Oct 25, 2007

I have a spreadsheet with the following headings:

A
Claims Number

B
Name

C
Scheme

D
Admin

E
Date

I need to create a user form that will "pop up" and ask the administrator to enter the above details.

A - should be created automatically (ie last claim number + 1)
B - user enters manually
C - data retrieved from a list
D - data retrieved from a list
E - date is the date the information is entered

View 9 Replies View Related

Uncheck Check Box + Check A Option Button Using Command Button

Aug 20, 2009

When I press a command button I want to:

Uncheck a checkbox made with Control Toolbox

Check a particular Option Button within a group box made with the Forms Toolbar.

EDIT: Clarification, I want both things to happen when I click one button.

View 3 Replies View Related

Get User Name :: Windows User Name?

Dec 8, 2009

How can I set a TextBox in a user form to the Windows's User Name?

View 6 Replies View Related

Get User Name :: For File Used By Another User

May 13, 2004

how to get informazion with VBA code about the name of the user who opened already a workbook on the network.

Usually if somebody wants to open a file that is opened by another user, office applications give informations that the file is open and about the name who opened that file.

Is it possible to get this information with VBA code, too?

View 9 Replies View Related

Check Boxes Macro: Macro That Will Check If The Boxes Are Checked And If Not Ignore Them And If So Run A Certain Macro

Jul 28, 2006

I have numerous hyperlinks in cells on a worksheet, next to these I have checkboxes. I am looking for a macro that will check if the boxes are checked and if not ignore them and if so run a certain macro.

View 6 Replies View Related

Log User Changes

Jul 28, 2007

I am trying to integrate an optimization model to a simulation model using VBA in Excel. I am using ShellandWait and calling some batch files to call scripts for application command line operation. Everything ran fine until I tried to read in additional data using modules from an Excel add-in that I customized (err, more like butchered actually). Now, as far as I can tell sporadically (the call to the new module occurs randomly), Excel just closes in the middle of the simulation. Are there certain types of errors that behave this way? Is there someway to view or create an error log or similar, that I can go over after the crash?

*Edit*

I actually solved the problem (it was a database timer expiration initiated in a fortran routine by the customized add-in). This was just pure dumb luck - in effect, I was trying the brute force approach and happened to hit the solution relatively early. If anyone knows of some method of logging Excel or VBA activity (I guess that is the right term)

View 2 Replies View Related







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