I have a userform that enters data into a hidden sheet, and it works fine so far, but now one of my bosses would like another sheet that contains some lookup data for the form to be updated every time the form is used. I'm thinking I can handle the data in the lookup sheet automatically deleting the older data but I can't figure out how to send the data to two different sheets when the form is completed.
Private Sub CmdOK_Click()
If MsgBox("Are You Sure This Form Is Complete?", vbYesNo) = vbNo Then Exit Sub
Unload Me
ActiveWorkbook.Sheets("Plant Production").Activate
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = txtDate.Value
ActiveCell.Offset(0, 51) = txtTime.Value
ActiveCell.Offset(0, 1) = cmbPlant.Value..........................
I have used a database template from this site and changed it to suit my needs but I have a bit of a problem with some of the code. I know how to update the worksheet with the relevant userform text fields and in another project I did I have successfully sent userform text fields in the body of an email.
For this project I want to update the worksheet AND send an email at the same time. However, using the two pieces of code together is causing an error that I can't seem to solve (using my very limited vba knowledge!). The code I am working on is below and I have highlighted the line that is getting the error message. C
VB: Private Sub cmdSubmit_Click() 'Submit new record Dim ws As Worksheet, lRow As Long, Str As String [code]....
creating workbook with macros or vba code. I have a workbook that has several sheets.
The first sheet (All Students) has a table / range of student information. There are several other sheets one for each teacher, that would contain the student information from first sheet for that teacher. Teacher name is in one of the columns on the first sheet(All Students). What I'm looking to to do is create a workbook that would contain all Students in first tab/sheet, data will be entered into first sheet by teachers.
When I click on any of the teacher tabs excel should get data from (All Students) tab / sheet and populate teacher sheet with data for that teacher based on teacher column in All Students. Any suggestion on how to create this workbook. I've attached a sample workbook with data. I would like to make sure data refreshes when I click on teacher sheet.
I need to make a userform that will add data to table placed (for example G12:H12), and if G13:H13 cells are written to next cells below (G14:H14). I would also want to receive auto email noticiation (or notofications by pressing another command_button) that someone add data with copied content of (G13:H13...G14:H14....) cells in email body.
I have been working on my spreadsheet for sometime now, so far when I run into a code problem I can figure it out using someone eles's post. However, I can't seem to figure this one out. I need to send data from a userform to specific cells on my spreadsheet based upon the users selection in combobox 1, and textbox 1.
Example: User selects customer name from Combobox1, and part number auto loads into textbox1 from the data sheet.
There are then 11 combobox's that can be clicked as the userform is updated. Once the user is finished, I need the answers from each combobox to transfer to the worksheet next to the referenced Combobox1 and textobox1.
I used the code that RoyUk posted to him, but have only been able to get the first combobox to copy to the sheet, the rest stay blank.
(Here is the code so far)
Private Sub CommandButton2_Click() Dim ce As Range, srcRng As Range Dim sYear As String, sMonth As String
sYear = UserForm3.ComboBox1.Text 'When combobox1 is loaded, use as reference#1 sMonth = UserForm3.TextBox1.Text 'When textbox1 is loades, use as reference #2 Set srcRng = Range("c2", Range("c65536").End(xlUp)) 'Search range on worksheet For Each ce In srcRng
I have created this with text, command & list boxes with a view to creating an asset register.
So the options i have are premises, hardware, software & fixtures. I have tested so that these go onto 1 sheet ( at the moment all additions go to premises) but i require for it to go to there respective sheets i.e. a sheet for each asset.
But, due to inexperience with userforms and VB i don't know how to do this.
Also, how can i get a sequential number coming up for each asset on their respective sheets
I need the information that is entered in a userform to be sent to a separate worksheet. Each time a user fills out the form, I would like the information to be documented on the next completely open row (ex. first form goes in row 2 (column headings are in row 1), second form goes in row 3, etc.). I don't know a ton when it comes to VBA, but I believe I have the code figured out to search for the next open row. Column A will always have data in it.:
Code: dim currentrow as range set currentrow=Range("A1").end(xldown).offset(1,0).entirerow)
What I can't figure out is how to insert the information to the correct columns. Each column has a header to it, and I would like the data from the userform to be put in the relevant column each time it is filled out.
For example, if column A's header was "First Name" and columm B's header was "Last Name", each time the form is filled out, I would like the first and last name (which was entered in the form) to be inserted into those columns (with each form entry on a separate row).
I think there might be a way to use the intersect method to find the row/column combination I'm looking for, but I'm not exactly sure how to do it. Using the first name example from above, it would basically look for the intersection of "currentrow" and column A, and insert the value that is entered into the userform.
Is it possible to have a single userform put data into two separate sheets within the same workbook.
I have a userform set up for entering client data into a quote register,with no problems ( sheet 1)
A1, A2, A3, A4, A5, A6, A7, A8, A9
What I would like is for the data to also go to sheet 2, where I have a form set up to print off for our technicians to take on site.
The problem will be that I would like the data A1, A2, A3, A4, A5, A6, A7, A8, A9 not to store on this sheet after it is printed, so the next set on entries , can be printed etc.etc
I have a multipage wizard like userform that for each page has check box selection choices a user can pick from. The sample I've attached uses animal attributes for 2 animals. What I'd like to have is code that populates the worksheet with the animal under consideration (determined by the Frame Caption) in say A5, then populates the attribute selections made starting in B5 with no blank rows in between if they chose not to mark a checkbox.
So for animal one on page 1 of the multipage form, if the user selected attributes 1, 3, 4, and 6 and clicked the "NEXT" button on that page, animal one appears in A5 and then those attribute selections would be in B5, B6, B7, and B8. If the user then selected for animal 2 on page 2 of the multipage form, attributes 2 and 6 and clicked the "NEXT" button on that page, then animal two would appear in A9 with the selections appearing in B9 and B10.
I should mention that the number of rows in Table 1 may grow (or shrink) row size with additional rows added (or deleted) by the user. Not sure if it matters.
I used Scheduled Task to set up my spreadsheet to open daily. I have the code with assistance to pull out the due date items and place them into an email.
I have come across XLSTART/AUTOEXEC/ACTIVATE...ETC... But cannot figure out the code that will automatically "enabling macro" once Scheduled Task opens the spreadsheet?
Then once the macro runs, the email with the due dates, how can this auto send without user interaction? (currently I would have to hit send)
I am trying to make the process totally automated to open the spreadsheet at a certain time, send the email with due dates and close the spreadsheet.
Following code in ThisWorkbook--
Private Sub Workbook_Open() Check_Date_Send_Mail End Sub Code in Module1--
Option Explicit Sub Check_Date_Send_Mail() Dim wbBook As Workbook Dim wsSheet As Worksheet Dim rnDate As Range, rnValue As Range Dim stAddress As String, stMsg As String Dim stRecipient As String, stSubject As String Dim stPost As String Set wbBook = ThisWorkbook Set wsSheet = wbBook.Worksheets("Sheet1") With wsSheet Set rnDate = .Range("d2:t23") End With
We use proprietary software to connect to an oracle database. The proprietary software has its own login form. I connect to 4 or 5 different databases randomly throughout the day. I wrote a script that I thought would alleviate my login woes but it doesn't work. The login, password, and database info get sent to the form but they all end up on the login line. Instead of the tab character being sent, I get a Beep generated for each line of code that is supposed to send the tab key code. My code is below and is stored in a *.vbs file.
setwshShell =wScript.CreateObject("WScript.Shell") wshShell.AppActivate "Title Of My Login Form" wScript.Sleep 100 wshShell.SendKeys "My Login Name" wScript.Sleep 500 wshShell.SendKeys "{TAB}" wScript.Sleep 500 wshShell.SendKeys "My Password" wScript.Sleep 500 wshShell.SendKeys "{TAB}" wScript.Sleep 500 wshShell.SendKeys "Name of My Database" wScript.Sleep 500 wshShell.SendKeys "{TAB}" wScript.Sleep 500 wshShell.SendKeys "~"
Now that the calculations are working, with the press of a button, I need to be able to select a range of dates and copy all lines within the range to a seperate sheet with the desired name under the same headings they currently reside under. I have included some modified code that is being used in another spreadsheet that was created for me, but I do not pretent to understand all of it and I no longer work with the creator of the spreadsheet. How do I use a button to open the form for date selections and entering the name of the new sheet, and then use the start button on the form to begin the matching and copying to a new sheet? If there is an easier way I am all for that too.
I have created a form for my work. And I have input boxes for users to add data that I would like to get stored in another worksheet. What is the vba code to send data for an input box to another worksheet at the bottommost empty row; first column.
Private Sub cmdAddData_Click()
' Collect user name, find the space between first and last names, and separate the names. UserName = InputBox("Enter the Program Name.", "Program Name") spaceLoc = InStr(1, UserName, " ") firstName = Left(UserName, spaceLoc - 1)
I have a list of data which i need to send to individuals. I can sort the data by person's name.
I need to send each individual person their own data. Instead of copying and pasting each person's data into a new tab for everyone, is there a quick way in excel that for each change in person's name (Column A), that it creates a new tab with all the data?
The data in 4 specific cells in C:UsersOfficeDropboxWB1 needs to (upon clicking command button) be copied to the next available blank cell in 4 specefic rows in C:usersOfficeDropboxWB2.
WB1 Specific Cells List Sheet1!A4 Sheet1!Q7 Sheet1!N22 Sheet2!E3
Data from these cells are to be copied to the rows listed below respectively.
WB2 Destination Rows (Next available blank row) Sheet1! Row B Sheet1! Row D Sheet1! Row F Sheet1! Row J
I gather from reading other posts that sending this data within the same WB is fairly easy, is it easy to do between WB's though as i must have seperate WB's?
I have two different workbooks. In workbook1 I have a table like below:
A B C
[Code]....
What I want to do is to create a drop down menu in workbook2 where I can select a name and then see below what time that person is working each day of the week.
I have a spreadsheet showing MOT details of vehicles. The details include 'Customer', Vehicle Reg', 'MOT due date', 'email address'.
Basically.. I want a method that will check whether or not the MOT due date is in 28 days time (so exactly 28 days from now).. and if it is.. then I want to use the email address that is on the same row to send the person a standard notification.. and if possible.. include details of the Vehicle Reg.
I am trying to write a macro to send mail on every Friday and also on last day of every month. If the last day of the month falls on Saturday or Sunday then the macro should mail on Friday. I have written a separate macro to send a mail. I have also written to check day(ie Monday, Tuesday etc) of today. If today is Friday or month end i can send mail. I dont know how to tell the macro to send mail on friday if the month last date is saturday or sunday.
Sub done() Dim Dat As Date, x As Integer, y As Date, sorry As String Dim str As String sorry = "Today is not friday or month end. So i cannot send mails" str = WeekdayName(Weekday(Now()))
I was given the code below which works for "sheet1",but when adapted it to write to sheet repairs as well, nothing writes to sheet "repairs", have tried different codes that works writing to 1 sheet , but am having trouble writing to both sheets from a macro,i know it can be done
I have workbook with 12 sheets in it. each sheet is identical except that they are for each month of the year. i am using a userform to enter the data into each sheet. Each sheet will have different data.
I want to be able to use the same user form on each sheet but still have them insert into the open sheet. Currently I am creating duplicates of the userform for each sheet but it gets VERY!!! tiresome and it is making the workbook VERY large (5 mb so far). For example. the first sheet is "april". i open the userform and enter the data into the userform. the userform enters the data into the sheet.
now i go to sheet "may". currently I open a userform in that sheet that looks exactly the same as the userform in sheet "april" but is a completely different userform. I want to be able to use the userform from sheet "april" in sheet "may" but when in sheet "may" it inserts into sheet "may".
I have created a userform and a command button to bring up the user form but when I click on the command button and the user form pops up I am not able to enter any data, the entire page freezes
This is the code
Private Sub CommandButtoncancel_Click() unloadme End Sub Private Sub CommandButtonOK_Click() With Workbooks("RETS results version 2.xlsm")
When i save this in my sheet, it is saved as text. While i want to calculate with this value as a date, i would like to know how i can save this value as a date.
user form that has a list box that only picks up visual worksheet (not hidden ones) and then allows the user to select which ones to print via check boxes.
Is there a way to use a userform and hidden sheets at the same time?
I want to limit the access to the information through a userform but my userform requires me to unhide the userform to show. Is there a way to go around this? Because the information might be misused if the user can simply close the form and have access to the information in the sheet.
I am trying to set up something similar to the old "print dialogue" box whereupon the user presses a command button on the userform and all sheets within the work book are listed (eg:sheet1, sheet2 etc) The user can select any amount of sheets and and using "OK" outlook is fired up- pretty similar to Ron de Bruins code for email.
I have tried taking the print dialogue vba and stooping it at copy, then trying to gets Ron's code to continue- without success.
There are great bits of code I've seen for select tabs and selct sheets from listbox, but I have found none to email once selected.