else if

  1. I

    Multiple If statement, else statement

    Hi Guys, I'm usually OK with if statements but when it comes to multiple criteria i tend to get a bit confused. Basically when a date is inputted that falls between the below date range i want the output in the next column to be the academic year. Hope that makes sense guys! Cheers...
  2. H

    Pull out names from a string, into multiple columns?

    Trying to run a quick script to pull a few names out of a string and place them in the column next to the string location. Cant seem to get this going. Any tips would be greatly appreciated. Sub james() Dim celltxt As String celltxt = ActiveSheet.Range("d4").Text If InStr(1, celltxt, "Sue")...
  3. C

    Compare data, if, then else if ?

    Hi. Sorry, new to this. Need to find a way to semi process some data. Perhaps easier to demo with a table. My data is column A has changing values, ie site names is not a constant, but the rest of the text is. I have about 50 of these statements. Each of these statements can be associated with a...
  4. K

    Can anyone fix my code using If and ElseIF?

    I have three blank text boxes in a UserForm. All of them should not be blank, or It gets message 'Fill All of Them' and also, if the value in the third text box is not a Date format, I want a message box "Enter A Date" Somehow,, my code is not working.. Please somebody help me out.. ElseIf...
  5. E

    Export and import script

    Hello all mrexcel members, If you look at my picture below it’s excel There are first subtitles on the first row, and different columns: “c++ object” and “translate this column”, then language combinations in different columns. The thing is, with the column “c++ object” and “translation...
  6. N

    Problem with IF coding

    I am having a problem when a macro runs. IF I don't want to delete order data, it should do nothing and return to the front sheet. IF I do want to delete data, it runs the correct process. At the end of my coding under ELSE, it will show a dialog box advising a user to re-enter a year, but it...
  7. S

    Elseif statements - 'Application-Defined or Object-defined error' help

    Hello, Currently I am trying to use Elseif statments to copy and paste information into a target cell from another cell on the same worksheet based on the value of the target cell. When I try to run my code, I recieve the following error message: 'Run-time error 1004: Application-based or...
  8. V

    Sometimes it works...sometimes it doesn't

    Hi, I have a particularly perplexing issue. The following code sometimes works and sometimes doesn't. I am using the Else If because the Select Case couldn't find it at all. The variable is exactly as the if statement, without the "". For instance '[CN caloriecalculator.xlsm]TDC'!$B$10 should...
  9. Prevost

    Creating a variable value (that's between two values) to use as a condition in if statement

    Hi There, I was wondering how I would go about making condition variables to use in IF statements. The end result of the code is to calculate the total number of hours that a project has been worked on based on a starting time and date and ending time and date. However, there are two breaks and...
  10. C

    Selecting If or Else

    I'm trying to see if a worksheet is already created. If it is Im calling UserForm2, but if its not it will create the new sheet. When I do this I get "Compile Error: Else without If". Any help would be appreciated. For k = 1 To Worksheets.Count If Worksheets(k).Name =...
  11. D

    Compile Error: Else without If, Expected: Expression AND End If without block If

    Hi! This is my first post so I apologise in advance if I do something wrong! I am very much a novice VBA user. I've been teaching it to myself so I can use it for my honours year thesis. I'm not sure if I have done something ridiculous here but I've included my code so you all can see. I keep...
  12. S

    using end if inside an if loop

    my code looks like this so far legend for coding/question below newvariable is the variable name for an inputted value ...A actions -the commands if the value is A ...X actions - commands if the value is not A or B if newvariable = "A" then ....A Actions else .....X Actions...
  13. S

    Not do anything if Cell is blank

    I have this code: For i = 7 To 2000 If Range("L" & i) <= (Date - 365 * (3 * Range("N" & i))) - 182 Then Address = Cells(i, 15) strbody = "Relief Valve number " & Cells(i, 1) & " at " & Cells(i, 2) & blank & Cells(i, 3) & Cells(i, 4) & " needs to be tested"...
  14. S

    Macro is So Close, but I Need Help

    This is an Awesome Forum!! Just recorded my first macro. It works pretty good, but I there are some errors in it. Here's what I want it to do. 1. Unprotect the "Areas" sheet so the macro can run. 2. Delete all info in given ranges in the "Invoices" sheet. (See macro below for ranges) 3...
  15. S

    Simple Loop Question

    Hello to those that take the time to read this and thank you. I am not asking for anyone to do my homework only I have not been able to find a solution so far. Scenario: I need a macro/VBA to look in a range of about 20 cells. The cells have an if statement that pulls data from a cell...

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top