I have a checkbox that hides a range of columns when deselected and unhides the range when checked. I also want the code to write a value (1) to a cell when hidden and change the value to another value (0) when unhidden.
The range is hidden and unhidden perfectly, but the value "1" is written and doesn't change regardless of whether it is hidden/unhidden. (the value flicks momentarily to "0" when unchecking).
Code:
Private Sub cbTermPrev1_Click()
If cbTermPrev1.Value = True Then Range("Term_Prev1").EntireColumn.Hidden = False
Range("HiddenValPrev1").Value = 0
If cbTermPrev1.Value = False Then Range("Term_Prev1").EntireColumn.Hidden = True
Range("HiddenValPrev1").Value = 1
End Sub
I have a command that opens up another workbook. This workbook is sometimes open on another computer, so that the book opens up on my computer in write-protected mode (shows in the top of the window). Usually, when opening other books through the Excel functionality, a message box appears if the file is open and warns that the file is in use by another user. However, with the code I have at the moment, this is not the case when I try to open with my command. See code below:
Private Sub cmdOpenBook_Click() 'Open book ChDir "I:DevelopmentSpecialUtvikling" Workbooks.Open Filename:= _ "I:DevelopmentSpecialUtviklingJointApp.xls" End Sub
Is there any way of displaying a msgbox warning when opening another file through VBA?
My company uses 4 types of barcodes 8, 12, 13, & 14 number barcodes for our products my problem is that I can't figure out how to force the barcode to format properly no matter how somebody enters it if they don't use spaces or put them in the wrong spots, I can't use custom formats because there is 4 different layouts
8 digit should be "#### ####" 12 digit should be "###### ######" 13 digit should be "# ###### ######" 14 digit should be "# ## ##### ######"
these barcodes are in columns L, M, & N also right now 'm using a formula in another cell to verify the barcodes by calculating the check digit and comparing it to the check digit typed the formula i'm using is
I have data in Row 53 that spans 7 columns, but stays in the same row. I want to design a loop to select every 7th cell in that row and check if it is empty. If not, add onto a "counter" then display the final number of occupied cells (the value of the counter) at the end. This is what I have so far, but I get all sorts of errors.
Code: Sub Tester()
Dim WB As Workbook Dim WS As Worksheets Dim modCounter As Long Dim Cell As Range
Set WB = Workbook("Transverse Series.xlsm") Set WS = WB.Sheets(BM18)
I want to have 1 check box affect 3 others in the following way: check box 1 if checked, allow check/uncheck of check boxes 2, 3, 4 if unchecked, uncheck boxes 2, 3, 4 and do not allow checking check box 1 is linked to D1 which starts with a value of false. cell E1 is if condition to have value 1 when D1 has value of true.
I am creating a userform with 10 checkboxes. The first 9 checkboxes are user options. I want the 10th check box to be a "Select All" option i.e. if the 10th checkbox is checked all the other 9 options are deemed to have been selected.
The way I want the display to work is that if the 10th checkbox is ticked all other checkboxes are cleared. Also if the 10th checkbox is ticked and any of the other check boxes is selected then the 10th checkbox should be selected.
I have tried coding this up but the checkboxes don't seem to operate as desired. I placed some code on the click event for the last option button to set the vlaue for all other buttons to false. This works but the 10th check box doesn't get ticked itself. When I try to code up the other bit I get similar issues.
I'm wondering if an if then else function can be written for the problem that I'm having? Or is there a better way to accomplish this? I've detailed my problem within the example attached.
I have a question, that could be answered by the experts in this forum. Question: I need to write the letter "E" in the second column (B) when I find that any cell in a row is in orange color (color 44). The code I wrote:
I basicaly need to look down column Q8 to Q52 for the falue "C19" If that value is present - Then I need to look up the value of associated with what is in its respective cell in column O8 to O52. Then add them all together.
I have the formula that follows and it works, however it is huge. I have to repeat the IF,Vlookup 44 times. Just wondering if there is a better way.
Here is the formula I am using.
=SUM((IF(Q8="C19",(VLOOKUP(O8,clusterequipmentvalues,2,FALSE)),0)), (IF(Q9="C19",(VLOOKUP(O9,clusterequipmentvalues,2,FALSE)),0)), (IF(Q10="C19",(VLOOKUP(O10,clusterequipmentvalues,2,FALSE)),0)), (IF(Q11="C19",(VLOOKUP(O11,clusterequipmentvalues,2,FALSE)),0)), (IF(Q12="C19",(VLOOKUP(O12,clusterequipmentvalues,2,FALSE)),0)), .... all the way to C52.
Excel is a new program for me sorry to say it but i have been try to figure out how to write a schedule on it and tally the hours for each employee i have them set up in rows right now and i hope i can keep it that way but i am tired of add hours up for each employee every week i'm sure it is really easy but can some one let me in no the little secret
I recived the small job of making a template for my company for travel. I had spare time so I added in a feature so they can just e-mail it to the approite person from clicking a command button intead of taking the time to click the built in excel e-mail function and typing the addresse.
Anyway, this from tells the person who it is being e-mail to, what flights to book.
I have differnt command buttons to bring up differnt airline webpages, bascially a hyperlink but in command button form. Is there a way, just because i have time, to take the flying dates from excel, input them into the webpage which the command brings up, and search for the flights for that date, just by clicking a button in excel?
i have accumulated a lot of data on an excel sheet now i need to be able to run 2 reports that will spit out the data in a specific way but i have no clue but i have made a word document to show how i would like it to spit out
need to write this forwula for excel 1000((value from cell)+.256)=(((x+.314)1000)+9)1.0625. I would like to plug in a value from a cell and find the comparative value x. I am comparing the airfregiht cost between two carriers that have different surcharges for fuel, secuirty, and tax. One has no security or tax.
I am having some trouble setting up an excel spreadsheet. I dont know alot about this kind of thing so if it comes out confusing i apologise.
what i need to do is the following:
1. I need to have a cell which holds a range of data for example between 7.5 and 7.99, then the next cell 8.0-8.49 etc. How would I go about doing this?
2. I then have 2 tables side by side. on the first table i want to be able to write a number in, say 7.6, and once i enter this number i need in the second table for it to have sorted which of the above fields it fits into. I know you can have colours for each field, and that is the way i would identify which data range it fell into.
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 one cell that contains a function. Sometimes I want to change the value in the cell because the value is used in another function in the sheet. The problem is that I want the function to reapear in the cell when I press the deletebutton.
Exampel:
1. Cell A1 contains this function. =Sumproduct((part_number>100)*(Price>10);Stockvalue) This returns a value that is used in other cells in the sheet.
2. Now I want to try what happens in the other cells if the value in cell A1 is changed. I select cell A1 and writes the new value that I want to test.
3. If I want the function back I simply should select cell A1 again and press delete. 4. A VBA macro now writes the original formula back into Cell A1.
I managed to write my script with pretty much the info I could find on the forums (yes!) but I need to write my data to the last row. Columns A - D of the last row will be populated with the content of my variables. This little snipped gives me the first empty row:
I'm trying to learn VBA programming (I started some years ago already, but felt it was a bit too difficult for me) and I would like to ask two (perhaps very basic) questions:
1 - Can someone give me a code which does the following : In A1 I have a string : "This is a test." I want it in rewritten in column C1-4 as follows : C1 This C2 is C3 a C4 test.
2 - A code which does the following : In A1 I have a word : "Testing" I want it this word as split up in 1 character/cell as follows : C1 T C2 e C3 s C4 t C5 i C6 n C7 g
been trying to do some more sophisticated charts in my excel sheet. I would like to be able to write some formulas, e.g divide one arnge with another and show the result in the graph.
Private Sub TextBox135_Change() On Error Resume Next TextBox138.Value = Format(CDbl(TextBox135.Value) / CDbl(TextBox86.Value), "0.0000")[code].....
It suppose to take one input and calculate for the other variables the problem is that once it writes the outputs the other text box it activates the second text box code so I keep getting the error "13" and the result is the same no matter what number I put.
Trying to write a UDF Code for a User Form. The User puts in the data for the element it is trying to find the pressure in mm Hg for.
I want a Msg Box to appear when the desired temperature is less than the lower limit temp. and the desired temp is greater than the upper limit temp.
I figured out how to get the message box to appear, but I have not figured how to get the If statement to continue with the calculation if the desired temp is within range. When I press the command button to calculate, the message box appears whether the temp is in range or not.
My code is as follows:
Private Sub CommandButton1_Click() Dim A As Double Dim B As Double Dim C As Double Dim Pvapor As Double
I am trying to write a formula using IF, OR & AND combined together, but I can't see to get my formula in the correct order. I have tried moving several sections around but I still keep getting an error.