elseif

  1. D

    vba should reformat time

    I can't get this code to reformat the time to hh:mm and keep the numbers there. it just clears the number and reformats the field. Private Sub Worksheet_Change(ByVal Target As Range) If Selection.Count > 1 Then Exit Sub End If If Not Intersect(Range("C3:N33"), Target) Is Nothing Then...
  2. S

    Message Box Code

    I have some code which prompts users to fill in all the required fields in an excel worksheet before a copy of the sheet is created. I want to add something into the code to also prompt users to select a reason if they have entered a value of 'No' in a previous cell. I have done some googling...
  3. C

    Loop over range and find data-type

    Hello everyone. I am having trouble finding the datatype in a cell, using a function. I have the sub to pass the argument into the function, the function itself is detecting the datatype (somehow it shows 0 as double, no decimals specified in the cell). But in the subroutine the myCheck value...
  4. C

    Elseif not being recognized in IF statement

    This statement --> ElseIf rng2.Value <> dstRng Then MsgBox rng2.Value & " not in RVP Group GAAP sheet" is not being recognized for some reason, and I made sure to set values not equal to each other. Basically I am trying to apply error handling to my if statement below. it works perfectly when...
  5. N

    How do I adjust code so that I can run VBA with out being on Sheet1?

    Sub works great, but I must be on sheet1 before it will add numbers to sheet2. How do I adjust code so that I can run vba no matter what sheet I'm on. This is a hassle because I have 15 of these and switching back and forth is time consuming. Sub actualAPR() Dim a As Long, b As Long, c As...
  6. B

    Speeding up a selection change routine

    Hi all, Is it possible to speed up the following routine: Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Range("a12") = "UAN" Then Range("z12") = "Variable" ElseIf Range("a12") = "" Then Range("z12") = "" Else Range("z12") = "Fixed" End...
  7. I

    Text box change to load two pictures

    Hi, I have the code below which works fine. I have now added another Image box called Image2 and asking for some advice please in reference to also load a second photo into it. Currently the working code below only loads a photo into Image1. I am looking for advice to edit the code so at the...
  8. S

    If statement in VBA

    Hi! I'd like to implement this code in VBA. I didn't succeed to do it. case1 : MENU PRINCIIPAL!J5=3 IF C6="X" then I6="X" ELSEIF D6="X"then G6="X" elseif E6="X" then H6="X" elseif F6="X" then M6="X" Case 2 : MENU PRINCIPAL!J5=4 IF C6="X" then M6="X" ELSEIF D6="X"then G6="X" elseif...
  9. N

    Using if else if to determine file location

    Hey guys, I am trying to use a If ElseIf to determine where to save a file. For instance if A2 equals A, it will save in one location. If A2 equals B, the file will save in another location. Below is the VBA code I have so far. It will recognize the first if statement but will not carry out the...
  10. R

    why does this only work on the worksheet_change event?

    Greetings, I am using this code on a worksheet to change the fill color on a shape dependent on the value in one of the cells. It works great and so I would like to use the same technique in a different WB; but I want to assign it to a command button instead. But I keep getting an error code...
  11. N

    For each looping right but output wrong...

    I first of all thank you all for your efforts in helping ...I "think " I am slowly grasping things more and more everyday but with For Each statements, I still have some problems..looking at the code below Dim MyPlayer As Range For Each MyPlayer In Range("C3:C17") If MyPlayer.Value =...
  12. R

    Worksheet_Change maximum events

    Greetings, I have a worksheet that I use to record the filter efficiency in our cleanroom; This cleanroom has over 400 filters in it. In an effort to give the engineers a "graphical view" of the impact of the filters on the equipment in the room I created a worksheet where I use rectangles for...
  13. S

    If, elseif, else.... Next without for error

    Someone please, for the love of God, tell me what my code is missing so I can move on. I keep getting the "NEXT WITHOUT FOR error, and it won't run my macro. I know this has to be a simple fix, but I've been up since 5am... my brain is too fried to look up anymore answers. Thanks Excel Giants...
  14. K

    VBA Help: If workbook is open return an error with option to retry

    Hi, I have two workbooks, WB1 & WB2 as an example. WB1 contains my UserForm and WB2 contains the master data where the entered information from the UserForm is placed. My issue is that multiple people need to submit data via the UserForm yet if the 'Submit' button is pressed by two or more...
  15. K

    VBA Help: Check cells are completed before submitting data to workbook

    Hi, I'm new to the VBA world but I am getting there slowly. I have created a UserForm with a number of text and combo boxes. I am currently stuck whilst trying to sort out the command button. :confused: What I want to happen is that when the 'Submit' button is pressed, it checks that all the...
  16. J

    VBA - Run Time 91 error

    Hello All, Posted is my code: ______________________________________________________________________ Private Sub UserForm_Initialize() key = InputBox("Which Line is this for?", "Line # ?, please enter ONLY a number") If key = "1" Then ElseIf key = "2" Then...
  17. S

    i need help with macro for hiding column

    Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$D$5" Then Dim b13val As String b13val = Target.Value If b13val = "1" Then Sheets("INPUT").Range("E:G").EntireColumn.Hidden = True ElseIf b13val = "2" Or b13val = "3" Or b13val = "4"...
  18. S

    Excel VBA Not Running Second ElseIf statement?

    Hi All - I have a CF macro that I'm applying to 20+ worksheets within a workbook. However, there are two worksheets that don't contain the same formatted data and I need to run a modified version of the CF statement to these two worksheets. Initially, I just wrote two elseif statements and...
  19. L

    Exceeded Nest In If Function

    Hello first time poster. I have exceeded the nest limit for an IF function and I was wondering if someone could help me come up with a solution. I don't mind creating another sheet and then using the VLookup or if there is something better. I am trying to do this in VBA and the only input would...
  20. W

    VBA/Macro Help- Hiding Rows Based on Cell Value

    Hello- I am trying to use a simple macro to hide rows based on the value of three different cells. The code tat I am currently using is below. The first portion works correctly, however when I copy it to use on the other required rows it doesn't work. Can someone please assist? I'm new to VBA...

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top