Code Before Print Add Inputbox To Change Date
Jun 1, 2007
I was wanting to input the date Before Printing. I want to write some code.
Private Sub Workbook Before_Print (cancel as booleen)
Inputbox = "Enter the date you would like in Mondays cell C4"
Application.Worksheet.Range("C4").Value = InputBox.Value
PrintDialogBox.Show
End Sub
I know I am making a very rough attempt at what I am trying to achieve, I just don't know coding that well.
View 9 Replies
ADVERTISEMENT
Aug 14, 2014
If numbers has been pasted in as text I cant convert them after. It convert the text to numbers and after it make a custom format with 5 zeroes.
I would really like to have the possibility to set the range with a input box and after set the numbers of zeroes/digits I want to have there. But have had problem put it in the code.
Have a look at the code below I have also pasted a test sheet to work with.
[Code] .....
Attached File : Testconvert.xls‎
View 4 Replies
View Related
Apr 25, 2013
I have 4 columns, If column B (Ref No) is filled in, the adjacent columns, C,D and E become mandatory and an input box pops up on screen one after the other for entry into each column.
My problem is that I require a drop down list and not a input box for the final column (status). So i have created a userform with a combobox dropdown. I am having problems connecting the combobox selection to the final column, and for the selected combobox item to go into the right cell like the input box entry currently does.
Attachment 53209test743.xls
I have attached a sheet and also you can see the code below.
Code in Sheet
VB:
Public SaveVal1
Public SaveVal2
Public SaveVal3
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
[Code] .....
View 3 Replies
View Related
Jun 23, 2006
I am writing a module which have a different test based on for each of the previous 2 column cells. It calculate the days passed or in simple way calculate the date difference for the 2 columns and puts them in third. But i need to use a inputbox for entering the first date for monday of the month each time i use the worksheet.
When i try using the module for each cell of the column it display the input box for each cell. is there any way so that i just enter the value in input box and it can be used in rest of the module.Without using it again and again.
View 8 Replies
View Related
Sep 29, 2012
I am making custom time sheets to suit our agriculture business - these excel sheets get sent out to the different farm managers who send back in staff times.
This code below is brilliant and works perfect for our needs. However I need to be able to emailPDF the sheets not print.How / where do I change code so the selected sheets go to Save & Send via email as a PDF instead of going straight to the default printer .( hard copy )
VB:
Option Explicit
Sub SelectSheets()
Dim i As Integer
Dim TopPos As Integer
Dim SheetCount As Integer
Dim PrintDlg As DialogSheet
[Code] .....
View 5 Replies
View Related
Mar 29, 2014
At work I have a register/log. Its just a printout of a standard format in excel sheet. I print a month of sheets at a time and write the day and date on it by hand at the top. Is there some formula in excel by which it prints the dates as well in a progressive manner. Eg. If today is 29th May 2014 and today I print 30 copies of the register/log. The first copy has todays date on it and the the next one had tomorrows date....and the 30th copy automatically has the end of April 2014 printed on it.
I've found this code but cannot get it to work.
My workbook is called Shift Log, the worksheet is called v2 and I'm using Excel from MS Office Professional Plus 2010 (32bit)
#Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, _
ByVal Target As Range, Cancel As Boolean)
Dim sDate, i
retryDate:
sDate = InputBox("Enter the starting date, or click 'OK'" & _
" for the current date", "Start Date")
[Code] .........
View 3 Replies
View Related
Apr 18, 2009
I have a macro that asks the user what pages they would like to print on a particular sheet. In the example below, a button will be assigned to pages 1-5 on a sheet and thus the user has the option of printing from page 1 up to page 5. Any page number outside this range will result in an error message and the user will be asked to re-enter the end page number. This is the code I pulled from this forum and partially modified:
View 4 Replies
View Related
Jul 2, 2009
I am having trouble disabling the "Preview" button when calling Application.Dialogs(xldialogprint) in XL2003. I have an xlSheetVeryHidden worksheet containing a form which is made visible programatically when the user wishes to print a copy (code below). I want the user to be able to have access to the functionality of the xlDialogPrint dialog (i.e. select desired print destination, number of copies, pages per sheet etc.) but I also want to prevent them modifying the page setup of the protected worksheet by initiating a preview from the print dialog.
Private Sub btnPrintReturnForm_Click()
wbkRUSC.Unprotect sysPass 'unprotect workbook to enable changes to sheet visibility
' (sysPass is project constant string containing password)
shtStaffForm.Visible = xlSheetVisible 'make staff form visible
shtCalc.Visible = xlSheetVeryHidden 'hide main calculator in case user gets smart and hits..............................
View 5 Replies
View Related
Apr 7, 2014
I am trying to create a vba using only one macro button (excel). I would like for them to enter their names and have their own password that will then insert their signature(pic.jpg) in a specific cell.
I created a certificate in excel and I don't want 12 (number of people) buttons visible. Id rather have a long code. Im not sure if using If and Then and ElseIf is the way to go.
View 8 Replies
View Related
Jun 15, 2009
I have been using a specific macro for at least 2 years now without incident...
but today for some reason I am get an error: ....
View 10 Replies
View Related
Sep 2, 2006
Is it possible to get a inputbox to validate an entry as time in the format of HH:MM
ie: user must enter a valid time in the above format before the macro will proceed to the next line of code
View 7 Replies
View Related
Feb 9, 2014
It show error, how to correct it .
[Code] ......
View 1 Replies
View Related
Sep 14, 2009
I have a VBA code that works really well but i wondering if there is a way to do the same thing but without the message box and just enter in the dates instead.
View 11 Replies
View Related
May 27, 2013
I made a selection and coloring macro, the filter is based on the inputbox that pops up. What I would like to do here is, that when the box pops up it would have a written date in it, which is the today always. And the filter should select all which is 2 weeks later than current date.
Code:
Sub kethet()
Dim datum As Long
Dim most As String
LRow = Range("E" & Rows.Count).End(xlUp).Row
[Code] ..........
View 5 Replies
View Related
Apr 20, 2007
I want to be able to validate the data input into an input box. It must be in the following format
Jun-07
First three letters of the month, a dash then the last two numbers of the year.
View 2 Replies
View Related
Jun 30, 2009
I have the inputbox so i can set a string value,
When the inputbox Cancle button is pressed i want to exit sub,
If the inputbox value is nothink and ok button, I want the msgbox displayed then goto newname.
If the inputbox has a value do >>>>>>That>>>>>
View 6 Replies
View Related
Mar 4, 2008
I am trying to get the user to enter a relevant date but code returns date in US format. That is mm dd yyyy instead of dd mm yyyy.
View 5 Replies
View Related
Aug 24, 2007
with creating vb code that will select certain rows in a spreadsheet, set the print area to those rows and print them out, and then reset the print area back to default.
The data is all on one sheet, but is split into 5 different areas, each below the next, with the column headers at the top of each.
e.g.
header_____header_____header
data_______data_______data
data_______data_______data
data_______data_______data
header_____header_____header
data_______data_______data
data_______data_______data
data_______data_______data
and so on. At the press of a button it'll set the print area to the first section and print (the section includes the headers as well as the data). Then at the press of another button it'll set the print area to the next section. There could be any amount of rows of data in each section so it needs to cope with that.
View 9 Replies
View Related
Sep 14, 2006
I am trying to create a simple code that will allow me to print a range that will change according to the initial inputs. The columns will never change, however the rows will.
So far I have:
Sub PrintLog()
Dim Printer As Range
Set Printer = ActiveSheet.Range("a9", Range("e65536").End(xlUp))
Printer
End Sub
View 4 Replies
View Related
Apr 24, 2012
I have a table of data (total 142 rows). Column contains dates, in the format dd-mmm-yyyy.
I tried to filter using DATE FILTERS->EQUALS and in the custom filter window, I chose EQUALS then picked a date from the date picker icon. The date I picked was 5/4/2009 (this is May 4, 2009, formatted automaticall by excel as m/d/yyyy).
When I clicked OK, nothing showed up despite the fact that there are 6 occurences of May 4, 2009 (formatted as dd-mmm-yyyy in the data table)
So my questions are:
1. Is this due to the formatting?
2. Is there a way to change the date format supplied by the date picker?
View 7 Replies
View Related
Jan 5, 2008
I have an Excel file that I believe was a template, maybe from MS. It's a loan calculator. Anyway, whenever you change the interest rate or number of payments it somehow knows to only print those rows - even though there are formulas in many of the rows beneath the print range.
View 4 Replies
View Related
Jun 10, 2008
I wrote a macro to do me page footers
Sub EditFooter()
With ActiveSheet
.PageSetup.CenterFooter = "Page &P of &N"
.PageSetup.RightFooter = "Préparé le " & Format( Date, "dddd, dd MMMM yyyy")
End With
End Sub
it works fine, howver I would like to change the font color to a light grey, and I have no clue how to do that.
View 3 Replies
View Related
Feb 6, 2014
Making a macro that selects active cells (so anything with text in) and sets that as the print area.
Using the default builder I have:
Range("A1:AA44").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWindow.SmallScroll Down:=30
Range(Selection, Selection.End(xlUp)).Select
Range("A1:AA692").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$AH$692"
[Code]...
Can trim this code with something
Range("any containing data").Select
ActiveSheet.PageSetup.PrintArea = "selection"
View 1 Replies
View Related
Jul 6, 2014
I have 2 codes that set up different "print areas". Every time i run one of the codes the print area doesn't get set unless i run the same code again. So if i run code A which will set the print area with no issues and then right afterwards i run code B then code B's print area won't get set unless i run code B a 2nd time. And if i now i run code A, the same issue happens and the print area to Code A won't get set properly unless i run the code again.
Here is part of the code that discusses the print area:
[Code] .....
View 6 Replies
View Related
Jan 13, 2012
Is there a way to Print VBA code in color, like how it appears on the screen?
View 1 Replies
View Related
Feb 13, 2013
I have this invoice spreasheet and I would like to when I excecute a macro to print, I would also like to use a PDFwritter to automaticly save/print the pdf file to a location and to ad the invoice number to the name like.
INV"current invoice here".
Bellow is the code I currently have. I am pretty sure this was done as I have some invoices saved but now it doesn't work.
Code:
Sub Check_Info()
If Range("AR1") = Empty Then
MsgBox "No Customer selected!", vbInformation, "Customer..."
Range("AR1").Select
[Code] ........
View 1 Replies
View Related
Nov 27, 2007
I have 7 digit values in Col B12: down. I have sheets with names that match any one of these values. Is it possible for a macro to print all sheets in my workbook whose name matches one of the values in Col B cells 12:down??
View 9 Replies
View Related
May 7, 2008
I have some code to select a print area depending on wether or not there is data in a cell. The code I have so far partially works but not quite like I need it to. Here's what I have,
Sub selectprintarea()
Select Case True
Case Range("C5").Value > 0
Range("A1:M47").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$M$47"
Case Range("Q5").Value > 0
Range("A1:AA47").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$AA$47"
End Select
End Sub
It will select the print range if there is data in C5 but if there is data in C5 and Q5 it only selects the first print area. I know I need an "If - Else" or something of that nature but I cant figure that out. Also I need it to look at other worksheets not just the active one. I've tried a replacing the ActiveSheet with Worksheets (Sheet1). but that gives me an error.
View 9 Replies
View Related
May 7, 2008
I have a print code that I want to run on a loop. In column A Sheet UPSLabels, I have record numbers 1 through 94.
I have a vlookup in "C1" of another sheet that looks at the record number in "B1" and pulls in the correct information from UPSLabels based off the matchin record number in column A. I would like my code to print, update the number in "B1" by 1, and keep printing the records until it reaches 94.
I've probably supplied too much information, but the point is, I need the loop to run until "B1" reaches 94.
Sub print_loop()
Dim cnt As Range
Set cnt = Range("L1")
ActiveWindow.SelectedSheets.PrintOut Copies:=cnt, Collate:=True
Range("b1") = Range("b1") + 1
End Sub
View 9 Replies
View Related
May 17, 2008
I have some code that Im trying to get to look at the sheets in my workbook and then based on if there is data in a cell and/or cells then select that sheet. Heres what I got so far thats not working. I get an error of Next without for.
Code: ...
View 9 Replies
View Related