elseif

  1. N

    Call cell in vba with var

    I have this set of code and it's saying I have a global var error and if by chance you have a way to make this code any less complicated that would also be appreciated. Sub test_if_statemnts() ' ' test_if_statemnts Macro ' ' keybox1 = ThisWorkbook.Sheets("contact").Range("B5") keybox2 =...
  2. D

    Elseif Code Working Partially

    Hi, I have below code that should highlight cells R3, R4, R5 in black. However it is only highlighting R3 and R4 and not R5. Can someone please tell me whats wrong with i. Private Sub Worksheet_Change(ByVal Target As Range) Dim R1 As Range, R2 As Range, R6 As Range, R3 As Range, R4 As...
  3. M

    Looking for suggestion on how to rewrite a loop to make faster?

    I have created the following loop but it takes to long to run. Any suggestions on how to change it? I would be very grateful. New at this and self taught. Range("F2").Select Do While Not IsEmpty(ActiveCell.Offset(0, -5)) If Selection = "FIELD SERVICE" Then With...
  4. C

    Multipage userform click option on one page but if I go to another page it wont work

    I must be driving some of you crazy. I put in multipage userform with radio buttons to put value in a cell. I click a tab and a radio button and it puts the value in....but if I decide i needed the other tab page option, i click the tab and it doesnt replace value But it will replace value if on...
  5. T

    Format on Double Click Macro

    Hello All, My VBA is pretty weak, what I have is a conglomarate of on double click examples I found online that I have attempted to edit for my data set, and the addition of some code coppied from record macros to get formating values. Honestly, I am not sure if I am one letter off or 5 miles...
  6. E

    VBA - How to select/change shapes with the same name

    Hi, I developed a macro to change shapes colors based on the value of a cell. Originally I wrote this code ActiveSheet.Shapes.Range(Array("Col")).Select If Range("D69") = "0" Then Selection.ShapeRange.Fill.ForeColor.RGB = RGB(127, 127, 127) ElseIf Range("D69") = "1" Then...
  7. E

    If and Elseif with Date comparison

    Hello, Can you tell me please a formula for the following: if the date in cell A1 is earlier than the date in cell B1, fill the formula cell with zero elseif, fill the cell with a number Can you advise me please? Thanks!
  8. T

    Worksheet_Change

    I know that I'm missing something simple and am hoping that someone can point out what I'm missing :smile: Here goes: I have an 8 tab spreadsheet (Excel 2013) Formulas in Sheet1 151:A157 update with DAY()+1 based on the date entered into Sheet1 A1. So with 9/8/18 entered into A1, A151=9...
  9. I

    Check form before submit

    Evening, I have a working code that checks text boxes before the form is submitted. Also on the form are 3 CheckBoxes & 3 OptionButtons Below is the working code which works fine for the TextBoxes but now i need to allow for 3 CheckBox & 3 OptionButton Please can you advise. Private Sub...
  10. L

    VBA unable to copy and paste with selectionChange &unlocking/locking worksheet

    Hi Everyone, I am having problems copy from a different workbook into my current workbook. I can copy but i can't paste even within the same workbook. I've isolated down to my coding with Private Sub Worksheet_SelectionChange(ByVal Target As Range). I suspect it has something with me unlocking...
  11. S

    Combobox

    I try to create a userform using Comboboxes, here the value of Box3 depends on the choice made in Box2. My code does not work. Someone a solution? Kind regards Private SubUserForm_Initialize() ComboBox1.List= Array("BIO", "LAN", "MAT", "Prodem") ComboBox2.List = Array("klimaat","stoten") 1...
  12. imback2nite

    VBA help on conditional formatting.

    I was wondering if it was possible to be able to bold and italicize a name from a drop down box. I have a list of names on worksheet 3 that will get longer and shorter. I’ve named the range, Pro. Named Range =OFFSET(Pro!$G$1,0,0,COUNTA(Pro!$G:$G)). On worksheet 4 I have a grid with drop down...
  13. S

    Update Query with custom function DataType Problem

    Hi guys, I am stuck with an update query which gives me an error datatype issue. I have created a custom function to update phonenumbers Function TelefonUpdate(ByVal strText As String) As String Select Case True Case strText Like "0*#" If strText Like "0####/#*#"...
  14. B

    compile error: Block If without End If

    I have this code to hide and unhide rows and final got it to work on one sheet, but after adding the other 5 sheets now I am getting a compile error: Block If without End If....I am enew o VA so I am sure I am missing soothing simple, thanks for your help!! Bob Here is the code: Sub...
  15. D

    How to shorten this VBA code

    I have more boxes to come and need to know how I can shorten this to one code include all textboxes instead of a new sub for every text box that is added. below is the 177th time I had to write it Private Sub Textbox177_DblClick(ByVal Cancel As MSForms.ReturnBoolean) If...
  16. L

    Error Handling Within If Block???

    Hello I've had a requirement with a piece of work recently which involved me trying to use error handing within an if block containing several 'elseif' sections and an 'else' section. I couldn't get the error handler to behave as expected, as it kept jumping prematurely to the 'end if' line...
  17. L

    else without if error message

    Hi Not sure what is wrong with the following cold. Thank you so much +++ Sub grade() Dim x As Integer Dim y As Integer Dim z As Integer For x = 1 To 20 y = Workbooks(1).Worksheets(2).Cells(x, 1).Value If y > 80 Then z = "a" ElseIf y > 60 And y < 80 Then z = "b" ElseIf y > 50 And y < 60...
  18. C

    VBA - Reset Combobox\Textbox on another combobox selection

    I have combobox13 and textbox14 that reflects the combobox13 selection. I have another combobox1 and when I select "D18", Combobox13 uses a named field from my spreadsheet. If anything else is selected it uses a different defined field. However, I need it to first clear out what is in the...
  19. H

    IF elseif else conditional statement.

    I have a large messy data sheet that I export form a piece of software. I am trying to compile the date into individual forms that then can be printed into PDF's and send back to the users to as a confirmation. conference room request worksheet sample link...
  20. C

    Need Macro to Hide Columns Based on a DropDown Menu Selection

    I am struggling with a MACRO. I need to hide a range of columns based on the selection of a dropdown menu. Menu selections are 1-5 with the range of hidden columns changing based on the selection. I am pretty new at using macros and I am having a hard time. The macro runs but it hides columns...

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