Just to add that you should check if the value is a number before adding, as you may get an exception if you try to add to a string.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
With Target
If IsNumeric(.Value) then .Value = .Value + 0.01
End...
Some of you familiar with C may know the "continue" command, for example:
for (i=0; i<5; i++) // equivalent to For i = 0 To 5 in VB
{
if (some condition)
cpntinue;
some statement;
} // In VB this would say Next i
In this case, if "some condition" is satisfied, then instead of...
I need to select a range of cells from (1,1) to (i,8), where i is variable computed during the execution of my VBA routine.
Microsoft documentation (and my book) shows a way you can select the cells if the co-ordinates are hard-coded, e.g. range("a2:b3").select
However, how do you do that if...
For your reference, one of the pages I found (http://www.officecomputertraining.com/vbtutorial/tutpages/page16.asp) for the MsgBox function, lists the options for the buttons as follows:
vbOkOnly
vbOkCancel
vbRetryCancel
vbYesNo
vbYesNoCancel
vbAbortRetryIgnore
I want to create a message box with the text "Which plant are you upgrading?" and three buttons: "Live" "Test" and "Cancel".
The text is not difficult to produce, but I do not know how to generate the buttons. I have searched the help instructions of the MsgBox function but it seems that the...
Claus,
Thank you for your reply. I can understand your requirements now. Unfortunately I am not an expert in the subject, so do not take what I say as gospel.
With the default password protection functionality of Excel, you will be prompted to enter the password when opening the document (if...
Claus,
I am not exactly sure what you mean by your dedicated method.
Can't you simply have a macro which pops up a dialogue box prompting the user to enter a password, then when the user clicks OK, automatically change the password settings of the workbook? You can set up a button or menu...
I hope this is not too late for you. Do you mean something like this?
http://www.j-walk.com/ss/excel/faqs/protectionFAQ.htm
If you want a macro which changes the password to a new one supplied by the user. Just record a quick macro of the operation, then view the code generated automatically...
I am trying to copy a cell containing a time to another using .value but this results in a decimal!
Try running this on your computer:
Cells(1, 1).Value = "18:00"
Cells(1, 2).Value = Cells(1, 1).Value
In the first cell, the value is 18:00, but the value in the second cell is 0.75! (=18/24...