elseif

  1. J

    For each and If with worksheet function

    Trying to find time gaps based off each cell and its offset (the next cell down) in a dynamic range. My error message right now is 'object required' in the if statement. For Each cell In picks() If WorksheetFunction.Abs(cell.Offset(-1, 0).Value - cell.Value) > 0.02083 Then do something ElseIf...
  2. G

    VBA Code for not to Create/Copy Duplicate Rows

    Hi friends, I have created a workbook of 6 sheets who's VBA code I have writted is, Sub CopyDataBasedOnStatusCondtion() Dim lRow, cRow As Long lRow = Sheets("Sheet1").Range("A50000").End(xlUp).Row For j = lRow To 1 Step -1 If Sheets("Sheet1").Range("B" & j) = "9265553826"...
  3. C

    Help with simple routine

    I will never figure this stull out! Must be brain dead....Keep getting Else without If line 3 If Delete_Lst = Empty Then End If ElseIf Delete_Lst = vbNo Then Exit Sub ElseIf Delete_Lst = vbYes Then Delete_List Else ' End If Thanks in advance!
  4. N

    Is there a better way to make my code less tedious?

    Hi guys, I am making a datasheet for a power substation and I created a number pad that has a command button on it called "Next" what I want this button to do is every time it is clicked it will automatically go to a specific cell and then be filled out. As of right now I do have code that works...
  5. D

    Running a Macro up Pressing the Numeric Enter Key

    Th following code performs flawlessly. The code is in a sheet module as I do not wish for it to run throughout the entire workbook. The code calls for cell selection anytime a change is made to certain cells. I would like for the cell selections to be made upon pressing the numeric enter key...
  6. C

    VBA Copy and Paste with If statement

    Hey guys so I am having a issue getting my VBA to recognize my if elseif statement in macro. I want it to read the value of a cell and if the cell is not blank then copy the entire row say A45 to S45 and then copy it, go to a different sheet, insert a new row after the last row of data, and then...
  7. G

    how to substitute a column reference for an If statement

    Hi sht = Me.ComboBox15.ValueIf Sheets(sht).Cells(i, "A").Value = (sht) Or _ Sheets(sht).Cells(i, "A").Value = productCode Then Me.TextBox13 = Format(Sheets(sht).Cells(i, "C").Value, "0.00") I have the above Syntax that looks up a value on a worksheet, it works fine, but I would like to...
  8. B

    entering a vlookup formula into a cell using vba

    i am having trouble with the below code. i am trying to compare a cells text "Week1_Program" is the name of the cell with a list of that i have named each cell "WeekType1","WeekType2" etc and if they are the same return a range name eg"WeekType1Range","WeekType2Range"etc i then want to use...
  9. J

    VBA Code help

    I am trying to write a code that changes the color of tabs based on a count if function. The problem I am running into is that for the changes to take place, I have to click on one of the cells and press enter, and then all the tabs change to the appropriate color. I want the tab colors to...
  10. E

    Copy and paste VBA issue

    Hi all, Can anyone help with the below code. I'm trying to look through all sheets across the range G4:K4 and move any data from the cells into I4. There is only 1 cell with data but it can be in any cell of the range. It seems to work if I manually select a sheet and run the code, but doesn't...
  11. S

    Error Handler

    Have I written the following piece of code out correctly for handling errors? The XXX for error code is my own reference sheet of "error codes" so I can see which of the 187 modules (talk about a mess...) has an error and the other error code should come from excel. I want this to allow the...
  12. J

    Reading multiple boxes to produce one result (shortened code)

    Hey, I'm currently struggling trying to get this code working so I was hoping for a helping hand please?   the situation is: I have varying products that produce the owner's name as the outcome depending on circumstance. Initially I had it working fine from reading one column of info, but hit a...
  13. C

    Excel VBA AND <>

    Hey all I have some code that hides rows if a value in a column is = "TERMDT" which works great... But I am trying to get some working that has a few criteria What they asked for is "IF column Z (new status) is W, hide/remove UNLESS column D (BDCA code) is MMJ, MBJ, MNN, MBN, MML, MMP " The...
  14. A

    Checkbox Change Procedure

    Hi all, I have a load of checkboxes where once ticked (or unticked) put a "X" into a cell. Instead of: If Me.chkTempWarm.Value = True Then wsMain.Range("H25").Value = "X" ElseIf Me.chkTempWarm.Value = False Then wsMain.Range("H25").Value = "" End If If...
  15. M

    Tidy up VBA code.

    Hi I have VBA code that I have written....... It works but looks untidy. Can someone offer advice on how to tidy it up with a loop so I can extend the ranges that are compared? (Extend to B3:30 & C3:C30) Private Sub CommandButton1_Click() 'Security Pin If...
  16. earthworm

    Elseif macro to skip macro and execute another macro if conditions are not met

    I want to create a macro that will create new sheet and save the same if the value in particular cells are >0 I created one but its only saving one sheet at a time and not moving to second macro if the value in first cell is >0 Please assist Sub if_1()If Range("c2").Value > 0 Then...
  17. 3

    Cost Value Calculator

    <tbody> Cost value (Local currency) Currency Cost value 500 SGD 3664 EUR </tbody> So I'm stuck in a situation whereby, I'm supposed to convert the cost value (local currency) into cost (in USD). I had made a button to run the VBA Macro to calculate the values and paste back into the...
  18. C

    What is 'late binding'?

    Hi everybody, I'm still trying to wrap my head around the idea of 'early' and 'late' binding and I couldn't understand it. I've looked up on google but I don't know how to apply to my code. Basically, I started looking for solutions when I created a shared file but people using different...
  19. E

    VBA If statement not reading variable value correctly

    I'm having an issue that I've never come across. For some reason it is as if VBA isn't reading what the value inside a variable is. I've posted the variables and part of the code that is giving the grief below as the entire code is pretty long. The code defaults to the first if statement...
  20. J

    VERY Long Loop - Looping across "call" function?

    Hi all, Hoping for some assistance here. Attempting to create a macro which takes data from several points on one line and populates a different spreadsheet with the relevant data, then goes to the next line and repeats. I've managed to get it working as intended, the only problem being...

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