elseif

  1. C

    VBA ElseIf not running

    Hello, I think I have a fairly simple block of code here, and most of it works, but the ElseIf never happens to change the cell to V. The If before it has no problem setting the cell to H. I also tried just using an Else, but that didn't work either. I'm not getting an error or anything, and...
  2. B

    If Then Else statements resulting in multiple errors

    I am relatively new to VBA, which I've been using to solve basic problems and automate reasonably complex tasks for my workplace. My most complex one (so far!) is actually two documents: a data source housed in Excel and then the merge letter in Word. Rigging the Word document to do what I want...
  3. M

    VBA Sumif based on column headers

    Hi, I have two worksheets. The first contains the production plan with dates for column headers and products for rows. <tbody> Product 7.2.2018 7.3.2018 7.4.2018 7.5.2018 7.6.2018 7.7.2018 7.8.2018 7.9.2018 a 150 200 550 0 0 0 0 0 b 50 200 400 600 0 0 0 0 c 0 0 600 500 500 400 0 0 d 0...
  4. M

    ElseIf function working from List to find word's pair

    Hi! I need some help with a nested if function. There is a code which checkes for every word in my list and excutes some command based on the value of the cell. However, if the cell's value is on my list, then the "pair" of the word should be the cell's value which is stored on a list...
  5. D

    VBA code slowing down workbook

    I've been following these forums for quite some time and finally have something to ask all the experts here. I am working on learning to code in VBA, and I've been using code that I've found around the web to build up on what I need for my worksheet. My objective is to hide rows and columns on...
  6. C

    How to state ranges with Elseif in VBA?

    Good day Is there anyone that can assist..... I managed to get the code working for single cells but unable to get the code working for multiple cells. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Range("A6") = "" Then Range("A6") = "=A1" ElseIf Range("A1") = ""...
  7. D

    Excel VBA macro to run automatically based on environment user

    Dear, I would like to have a macro running automatically on a daily basis (if workbook is opened), on assigned schedule, and based on the environment user name. I have come up to the following code, but it does not work, and need your assistance to perfected: Sub RunSchedule() If...
  8. S

    Alternative to If... elseif... elseif... ?

    Good morning all, New member here. My job involves cleansing a data set before it's provided to a client. The data is pulled from our system through SQL report, into a spreadsheet. I've kind of fallen into this role: I'm a lawyer, but someone needs to do this to keep the client happy, and I'm...
  9. K

    Using Len and Mid For condition Formatting - VBA

    Hi, I have the code If Len((Range("I10")) = 3 And Mid((Range("I10")), 3, 1) > 5 Then (Range("I10").Interior.ColorIndex = 3 ElseIf Len(Range("I11")) = 4 And Mid((Range("I11")), 3, 2) > 5 Then Range("I11").Interior.ColorIndex = 3 ElseIf Len(Range("I12")) = 5 And Mid((Range("I12")), 3, 3) >...
  10. D

    Code needed that will divide a string of text between multiple cells if needed.

    Hello, I have a worksheet with three columns; column A is for the date, column B is for the student initials, and column C is where the instructor will enter his comments based on the training that day. My question is regarding the comments added in column C. Just to give a brief layout of...
  11. P

    VBA pass string value to textbox

    I have an If ElseIf in VBA and the code runs when I click a button. I have an unbound textbox [text97] that the VBA fills and a textbox [text63] that its default value = [text97]. When running the code, [text97] shows the correct value, but [text63] equals “”. If I comment out all the ElseIf...
  12. R

    Finding First Check in Time

    Hi, Am using the below code it picks the last check in time in the attendance data sheet: Since there are multple check-ins by an employee how do I ensure I am picking the first checkin time Sub Attendance()Dim a, b(), i As Long, ii As Long, n As Long, z As String a =...
  13. E

    How I move the cells from one side to another depending on another cells in Excel VBA?

    Hello I need a little help, I started to learn Excel VBA of a few and that's why I make this appeal to you. I need a VBA code which to replace him the bottom one (that goes, but to enter a code of 20,000 lines seems too many, isn't it?) On short, my problem is : In an Excel sheet I have a...
  14. R

    UserForm Validating Radio Buttons Are Clicked

    Hi All, I have a UserForm with 16 Radio Buttons (8 groups of "Yes" Or "No"). (They Are Named OptionButton1,2,3,4,5,etc.) I have a submit button - CommandButton1 I am trying to disable the "Submit" button until at least one button from each of the 8 groups are clicked. If each group has a...
  15. P

    Find special characters in a cell and highlight with vba

    Is there an easier way of highlighting cells that contain a special character (!~`@#$%^&*()_+-={}|:"<>?[]\;',./) instead of listing everyone separate like below? There can be letters and numbers along with the special characters. If ActiveCell.Offset(0, 4).Value Like "*.*" Then...
  16. E

    Conditional time formatting

    Please help! I'm trying to set a variable dependent on some input by the user. The user inputs 2 different times; and also selects the date. I need the code to compare these times based on "within an hour AND same day", "outside an hour" AND same day", and "Not same day". It's currently not...
  17. R

    Procedure Declaration Error When Summing Form Textboxes

    I'm trying to sum the value in 7 text boxes where the value of their coinciding combo box = "Interact". When I test this code, I get the following error: "Compile Error: Procedure declaration does not match description of event or procedure having the same name." The responses that I'm...
  18. P

    New to VBA - Using multiple dropdown lists to hide/unhide rows.

    Hi, I am very new to VBA and have spent hours searching for the answer to something I'm sure you will all easily be able to help me solve. I am creating an Excel form which expands (unhiding rows) as the user selects drop down options. The first half of the code below works perfectly. When an...
  19. O

    Hide a number of columns depends of a cell vaue

    Hello all , I have a problem with a code. I want to hide a number of columns, according to a value of a cell. If value is ='1' unhide "E:K" and hide "E:K". If value is ='2' unhide "E:K" and hide "F:K" If value is ='3' unhide "E:K" and hide "G:K" . . If value is ='7' unhide "E:K" and hide "K"...
  20. M

    Shortcut for Permutations with Repetition

    Hi all, in the excerpt of a code below I am trying to enter all permutations of 4 things. Is there a shortcut to do this without typing out all 256 permutations with repetition (4^4 = 256)? Thanks for your help! If Col = 1 Then Ary = Array (1, 1, 1, 1) ElseIf Col = 2 Then Ary = Array...

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