How To Dim A Response (from Input Box) Throughout Different Modules
Jan 21, 2014
I'm working with a substantial amount of code (which, due to its size, has been spread out into different modules). Whenever I transition from one module to the other, I have placed a msg at the beginning of each module to prompt the user to simply insert an integer to signify which version of the automation that is run. The following is an excerpt of a sample msg
[CODE]
Dim Msg, Title As String
Dim MyInput As Integer
' Define message."
[Code].....
Where, whatever report is being run, will be the same throughout all of the modules (for example, if you run the "Day" Report" at the beginning, the rest of the automation should be run using the "Day Report" code, not the "Night Report").
Is there a way to do one of the following
1. Label the input of "Day Report" or "Night Report" at the beginning of the automation (where the above except of code is how that would be done), and that can then be the determinant through the rest of the modules
2. Set my code in a specific module to, when it completes, automatically go to the same style of report (Day or Night) in the next module.
I have an input box that should only have numeric input. I have arranged for it to start loop back to the beginning of the box if someone enters letters instead of number, simply hits enter instead of making an entry, exiting on cancel. Now I need to have it loop if someone hits the space bar one time or more. Here is what I have:
Delta: On Error GoTo ErrHandler1 Response = Application.InputBox(Prompt:=MyPrompt, Default:=MyPrompt2, _ Title:=MyTitle) If Response = 0 Then GoTo Delta Z = Response If Response = Cancel Then MsgBox ("You have chosen to exit the macro. Shutting down.") Exit Sub End If If Response = False Then GoTo Delta If Response = 0 Then GoTo Delta
I am trying to work out how to stop input into a document if a certain response is selected from a form in excel 2007. Basically, i need some programming so if a question is answered a certain way - the user cannot continue completing the form as it becomes "locked" and an error box comes up saying this is the case - and what action needs to occur. As the list is a data validation list - i cant just separate it out - so that if one response is chosen over another then the error message appears.
For example the question might be "Will you use contractors". If the answer is Yes, the cell turns red and an auto response fills the cell (VBA has already been written into the document for this to occur). What i need additionally is an error box to come up saying "This audit cannot continue as a Minor Plan needs to be completed" and the rest of the questions responses say something to the same effect.
I am trying to achieve a response from a msgbox which will either continue with the sub or exit. I think my code is right but it doesn't seem to work and just carrys on regardless.
I'm trying to find a formula I can use to figure response time. The working hours are 7:00 AM to 3:00 PM and I do not want to count the hours between 3:00 pm and 7:00 AM of the next day.
Example:
Cell A1 has the call in DATE 12/06/07 and cell B1 has the call in time of 10:00 AM.
Cell C1 has the response date of 12/07/07 and cell D1 has the time of 9:00 AM.
So what I need is a formula in cell E1 that would count from 10:00AM untill 3:00 PM on 12/6/07 then pickup the count on 12/07/07 at 7:00 AM and go untill 9:00 AM.
So in this Example the final response time would be 7 hours or 7:00.
Trying to Have a User Pick A response from the first drop down list before the second is activated and then after they choose from that list have an error message appear if the vlookup formula returns a #N/A. Here is the code in it's entirety the problem area is in the Elseif Pipe category Right now it doesn't bug but it also doesn't wait for a choice to be made it just spits out all the messages
Private Sub Worksheet_Change(ByVal Target As Excel. Range)
Dim Add As String, Size As String, Sch As String With Range("c11:c52"). Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=MaterialList" .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = False End With
Private Sub CommandButton1_Click() Dim hojaRES As Worksheet Dim howMuch As Long
Set hojaRES = ThisWorkbook.Worksheets("Resultado") howMuch = 0
If total.Value = "" Then MsgBox "¿Are u sure u want a cero?", vbYesNo, "the total value is 0" End If
End Sub
I need to set the value of howMuch to 0 if one selects YES and ask for a new entry if one selects no. How can I specify the behaviour in depending on what the user decides?
I have an Excel worksheet that when a user enters something into cell A1 I want to clear cells (b2:b20). If I use an object, I can attach a macro to it, but I don't want to use an object. I want to use an Excel cell and then when the user types into it, I want to perform an action.
I found the below code in one of the posts and it was working fine uptill few days back. now, i get the error Run Time error '-2147220975(80040211) The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available
Sub CDO_Send_Workbook() Dim iMsg As Object Dim iConf As Object Dim wb As Workbook Dim WBname As String Application. ScreenUpdating = False Set wb = ActiveWorkbook WBname = wb. Name & " " & Format(Now, "dd-mm-yy h-mm-ss") & ".xls" wb.SaveCopyAs "C:/" & WBname Set iMsg = CreateObject("CDO.Message") Set iConf = CreateObject("CDO.Configuration") iConf.Load -1 ' CDO Source Defaults....................
I need a sumproduct to count response times in between 1-2 hours. The response times are calculated from an 'initial referral date and time' and a 'actual response date and time' (the difference between refererral and response time be across several days) and are in the format below:
Time between intital and contact
00:22:37
00:00:01
00:08:46
I have tried several different formula, but I can't get excel to recognise the time range I need. Its just the bit in red i need sorted.
I am building a template for a report. The report resides on the first sheet of the workbook and the subsequent sheets is where the user would paste the appropriate reports so that the formulas on the first sheet can pull the appropriate data. I have all my formulas working fine with one exception.
The data in question needs to be pulled from the sheet "Paste Adcap Report Here" and the column is AA. The common piece of data between the two sheets is in column C of the Adcap sheet and column B of the main report sheet. What I need to do is conduct a vlookup between the report sheet and the Adcap sheet using the account id's and then return either the date value in row AA or the word ongoing which would be those accounts which do not have a preset end date. So far a co-worker had been able to come up with the following:
The code is a bit screwy as she had to leave early. The problem we encountered was the entry in column AA for a non-ending campaign. It is represented by two hypens (--). This is what tied her up. we could not figure out why the formula was returning an #n/a instead of the term "ongoing" when it encountered the (--). Again, if the formula pulls a (--) then the word "ongoing" needs to be displayed and if the formula pulls an actual date value then it needs to display this date.
In which control of vba can I show output of my work to a user of the program? But there is a trick here. In the output form, I need to ask something to the user so that I can proceed. (I need to put a few labels and a text box in the output form)
I know how to create a basic dropdown list, but what I don't know (I don't even know if it is possible to do at all) is how to allow user type-in response if the "Other (please specify)" option is used.
Column A Question 1. What type of report are you using? Column B will contain
Type I Report Type II Report Other (please specify)
If Type I or II is chosen from the list, I don't want user to be able to change anything. But If the Other (please specify) option is selected I would like to give user an ability to type in type of the report he/she is using. Also, is there a way to have list options chosen based on another list response?
I'm wondering about class modules and what they can be used for etc etc? i want to continue developing my VBA and feel that this area is the next step?
I have managed to get it almost done with lots of help from here the last issue I have is this:
The module I want transferred is working the assigning of the macro within that module to the button is working, however, when it gets to the FillSalesSheet section it opens the said workbook but then jumps to the module and the FillSalesSheet in that.
Module 1 which I would like ignored on the newly formed workbooks looks like this: ...
It seems like I am asking a question at least once a day. I searched the net and forums and could not find an answer to this question. Thanks to everyone for the help I am making a lot of progress because all of you. Basically, I have a read-only workbook which the user gets a prompt to save as a new workbook for editing purposes. I have a autorun macro so now when the user opens their workbook, it contains my autorun macro. I do not want this. Is there a way to remove modules so that the users copy has no macro information?
I'm trying to produce a spreadsheet that pulls infomation from different web pages throughout the day. It needs to pull quite a large amount of information from different web pages hence I wanted to produce a subroutine which could be called with different variables for each web page, i.e. url, field, destination, etc.
To actually produce the query I recorded a macro and then used the code it produced. I then changed the URL to url, a string variable which holds the urls of the pages. The destion address was changed to destination, a range variable to store the destionation location, and the webTable was changed to table also a string variable to store the table number. This is shown below.