Unique User Input From Variably Defined List
Jan 8, 2008Is there a way to prompt the user to pick an input composed of the values in a given column. Also, if there are repeats in the column, those need to be ignored.
View 9 RepliesIs there a way to prompt the user to pick an input composed of the values in a given column. Also, if there are repeats in the column, those need to be ignored.
View 9 RepliesI have a cell B10 which contains a formula.
I would like a macro which copies this formula across the same row.
However, the macro should prompt the user to select a range.
Based on the range selected and in particular the columns in this selected range, I would like the macro to copy the formula only for the columns specified in the selected range.
This is what I'm trying to achieve: Display a list box (or any other appropriate form/active X control) to get input from the users which is usually a list of several terms. Once they've input the list, upon clicking 'OK' it should add them all to Col. B.
The above request WILL be a good solution, but if there is an advanced solution to this for eg., something like a list box with buttons, for instance: click on 'Articles' and it populates 'a,' 'an,' & 'the, click on 'Prepositions' and it populates all the pre-fed prepositions, etc. that would be PERFECT!
I have a financial dataset which I need to "clean" before manipulating/analysing.
Each row of the data represents a completed transaction and the first step is to delete rows that are done with particular (internal) clients; the client data (the client's name) is in Column D.
Currently, I delete the unwanted data by autofilter and delete (code below), however this means the clients to be deleted are only defined within the code. I would prefer to have a worksheet within the workbook where the user defines the clients by adding or subtracting their name from a list.
I have created a dynamic range for the client list by inserting a Named variable along the lines of "=OFFSET(!$B$3,1,0,COUNTA($B$3:$B$200)-1," which works fine.
However how do I work this list into my code so that it works when new clients are added or deleted?
Current code for deleting unwanted client data:
Sub filterdelete()
Dim LastRow As Long
LastRow = ActiveSheet.UsedRange.Rows.Count
With Range(Range("D1"), Range("D" & LastRow))
[Code] .....
I wrote a macro which creates desired output based on one default variables. But I want to change it to take user selected assumptions and perform the macro for each user selected variables.
I am confused with user forms and controls and what to use.
Can anyone give the code to how to add a list box to a userform and then add items to the listbox, and run macro based on thegiven input in the list box?
I want to present a user with a list that they can make a selection from and enter their selection in a cell. Sounds easy but.........
View 9 Replies View RelatedI want to write a macro that asks the user for input, but not any input. The input has to be either "D", "IK" or "CI". I would like for the user to have to select one of these options.
View 3 Replies View RelatedI have created the attached file and would like to do the following using user forms:
1) From the sheet 'Courses', select a course on schedule it on a date - No problems, done this using form 'Schedule Course'
2) I would then like to assign people to courses scheduled using 'Attendees' form - this is where I am stuck and will appreciate some help. Problems faced are:
I need to schedule the same type of course more than once however I want the user to have only one selection from the drop down list (Spin should appear only once even though I have 4-5 scheduled) - he should then be able to select one of the dates for when the course has been scheduled
Trying to convert an Excel 2003 macro to work in Excel 2007.
The problem line is
Dim MyDataObject As DataObject
I suspect the problem is a Missing Reference, but I cannot figure out which one. I have the same ones (in 2007) as 2003 except for one which is not showing
Microsoft Forms 2.0 Object Library
Is this the one it needs? It is called something else in 2007?
The ones I do have ticked are
Visual Basic For Applications
Microsoft Excel 12.0 Object Library
OLE Automation
Microsoft Office 12.0 Object Library
Microsoft ADO Ext. 2.8 for DDL and Security
Microsoft DAO 3.6 Object Library
Microsoft ActiveX Data Objects 2.8 Library
Microsoft Scripting Runtime
Microsoft XML v2.6
I am preparing a template for which I need a combo box. Becaue it is a template I can't have this combo box any specific input range. Because I won't know how long the data column (that wiill be used for input range) will be.
Also the data column will have many duplicates but the combo box needs to show uniques only.
I am using Microsoft Excel 2010 and Microsoft VBA 7.0 on my system. I would like to eventually create a PowerPoint and insert charts generated in the Excel workbook. In the meantime, I cannot get the basic PowerPoint created.
The line in red is highlighted blue when the compile error "User-defined type not defined" message box appears.
Public Sub TryAgain() Dim myPowerPoint As PowerPoint.Application
'
' do nothing for now
'End Sub
I have set the references such that Microsoft Project 14.0 Object Library is indeed checked. The Excel file only contains this code in a module. All sheets are blank. Nothing else is written yet.
I had a working subroutine which I moved to another workbook (rather than linking to it and having both workbooks open at the same time).
Now I get "user-defined type not defined" when it runs. Here is the beginning of the
Global oApp As Object
Sub UpdateForecasts()
Call Update1
Call Update2
End Sub
Sub Update1()
Dim dPath As String
Dim dDest As String
Dim dCondition As String
Dim dName As String
Dim FSO As New FileSystemObject
I coordinate access requests for several contracts, and I have to list the approved accesses in a list where each line represents one person and one contract. For each access request, there will be an arbitrary number of persons obtaining access to an arbitrary number of contracts.
The input would then be as follows: Joe A and Jill B request access to contracts 1001, 1002 and 1003 ->
Joe AÂ Â Â 1001
Joe AÂ Â Â 1002
Joe AÂ Â Â 1003
Jill BÂ Â Â Â Â 1001
Jill BÂ Â Â Â Â 1002
Jill BÂ Â Â Â Â 1003
To automate this task, I have made a simple macro for generating a combination list of all persons having obtained access to a selection of contracts.
My macro worked well when I only wanted to list unique and independent list items, but now I have been asked to include each person's email address. How I can change my code so that only one email address is copied into my list for each person?
Code:
Sub AccessList()
Sheets("requests").Select
Dim rng As Range, c As Range
Dim rng1 As Range, c1 As Range
Dim rng2 As Range, c2 As Range
[Code]....
Base 64 Encoding.
Dim objXML As MSXML2.DOMDocument
Dim objNode As MSXML2.IXMLDOMElement
Are causing the User Defined error, but the same workbook is OK in XP and Win 7.
VB6: Free, Easy and Quick Base64 Encoding and Decoding in Visual Basic [a NonHostile article]
Says you need a reference to Microsoft XML, v2.6 (or later) and the Win8/2010 workbook does have one for Microsoft XML, v6.0
I am trying to capture with Worksheet Change a command bar action like paste but I am getting an error :
“User-Defined type not defined”
Do I need a library of sort in References ??
Public Sub Right_Click()
Dim oControl As CommandBarControl
For Each oControl In CommandBars("Cell").Controls
Debug.Print oControl.Caption
If oControl.Caption = "&Paste" Then
oControl.OnAction = "MyPaste"
End If
Next oControl
End Sub
When I try to complile my VBA project, I get the following error "User-defined type not defined" but the compiler doesn't point to any line.
I remember what I did last was to rename a form and a Module, but I replaced their old names in all my code with the new ones ... Does this have anything to do with the error I am getting ?
Which I am trying to modify to fit my needs:
Code:
Sub Test()
Const cURL = "Website Here" 'Enter the web address here
Const cUsername = "XXXXXX" 'Enter your user name here
Const cPassword = "XXXXXX" 'Enter your Password here
Dim IE As InternetExplorer
Dim doc As HTMLDocument
Dim LoginForm As HTMLFormElement
[Code] .......
I get the error User Defined type not defined on line:
Code:
Dim IE As InternetExplorer
Do I need to use references? Is there a quick fix for this?
I have code that works for a particular website but I am having trouble making it work for others. This code seems more flexible than the other code:
Code:
Option Explicit
Public Sub Press_Button()
'make sure you add references to Microsoft Internet Controls (shdocvw.dll) and
'Microsoft HTML object Library.
'Code will NOT run otherwise.
[Code] ........
My end goal is to log on to several websites and pull data out of tables on the websites back into excel so that I can have a one stop shop instead of logging into many websites manually.
This code works fine when I use it, but not when a co-worker uses it on his PC. The code and VBA references are the same. He gets the "User-Defined Type not defined" error. I'm wondering if there is an Outlook setting that may blow this up.
the code was working on his PC and then it stopped though no changes were made to the code. That's why I think it may be blocked by an Outlook setting.
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
MailOutLook.Subject = "E-mail"
I've made a macro that inserts an entire new row above a specified cell, then updates each column of that row using offset.value and various constants and inputbox variables. Works great so far, unless I try to apply a validation rule to one of the cells.
The code I'm using to add the validation works okay when referring to a specific cell by reference e.g:
With Range("A1").Validation
etc...
However, when I change it thusly:
With Sheet2.Range("LastRow").Offset(-1, 5).Validation
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=Departments"
.IgnoreBlank = True
.InCellDropdown = True
End With
It doesn't like that one bit.
This is part of a private Sub attached to a button in the same sheet. I've had a scan through the archives looking for validation threads, but couldn't find anything that refers to problems with offsets (if indeed that is the problem here).
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.)
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 RelatedI 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.
I'm having trouble getting a User Defined formula to work. I received an email containing a User Defined formula for SUMCOLOR and COUNTCOLOR. The first sums all the values in like-colored cells, and the second counts all the cells of like-color in a given range. The VB code for the module is as follows:
View 2 Replies View RelatedPossibility of creating "on measure" functions for the necessities of every customer, but I have some things to ask in merit and I hope that you can answer to me:
- which are the differences between a User Defined Function and a Macro?
- also User Defined Function is written in Visual Basic?
Can you create user-defined events in excel? I ask because the worksheet_change event does not capture pastes or undo/redo.
View 4 Replies View RelatedI am trying to create a function using the functions of IF and "And", but for any reason I don't know how to add the Add function
My function written in excel will looks like =IF(AND(A80="00",C80<>"8300"),"yes","no")
LOB Cost Center
00 1000
00 2000
00 8300
01 5000
02 8300
Function Allocation(LOB As Integer, CostCenter as Integer) As String
If LOB = 00 And CostCenter <> 8300 Then
Allocation = "Yes"
ElseIf LOB = 1, 2, 3, 4, 5 Then
Allocation = "No"
End If
End Function
I have created a custom add-in with custom functions and am trying to make it user friendly for other users. By running the following macro I can add functions to different categories, but I was wondering if there was a way to do this automatically so that anyone that adds this add-in will have the functions show up in the proper category without having to manually run this macro.
View 6 Replies View RelatedMy goal is a macro that exports a .txt file where the user selects desired rows (strains, not necessarily contiguous), header columns (collection data), and a single sequence column. The output format (called fasta) is:
>headerA1 headerC1
sequence1
>headerA4 headerC4
sequence4
where each new ">" is a new strain (row). My code so far gets caught up in the string assignments in the for loops:
My question is about creating User-Defined Data Types. Is there ANY way possible i can create a User-Defined Data Type that declares a variable of another User-Defined Data Type instead of the Pre-Defined User Types like String, Integer, etc?
The following explains my problem in more detail.
I know to create a User-Defined Data Type at the top of the module before any procedures. Like this:
I can't get a simple function to work. I attached a screen shot of my function. It's very simple -- adds two numbers.
View 4 Replies View Related