vba

  1. E

    Cannot use "Right" Function. Apparently meaning has changed.

    I have a large VBA project I'm working on that uses the "Right" function a lot. All of a sudden it gives me an error message of... "Compile Error Wrong number of arguments or invalid property assignments." When I try to compile, with the "Right" Function highlighted. What's really strange is...
  2. T

    VBA to sort table on two column values

    I am trying to write a macro that will sort a table by two column values. It seems like my current attempt is sorting the table on the virst column identified and ignoring the second sort value. Code is placed bellow, any direction will be greatly appreciated. Dim tbl As ListObject...
  3. D

    How can I select a Specific Cell and execute a function in another cell if it is found

    I want to be able to check (This is the first With statement) if a certain cell value ("H4" in this example) in the open worksheet (I refer to this worksheet as Sheet1 as it is Sheet1 in my workbook) where the code is being written (what is the proper naming scheme for this worksheet where the...
  4. T

    Required Field

    I have the following code in a button and would like to add the code to check for required fields on the spreadsheet before it sends the email and to not send unless all the required fields are required, but not sure where to put it in this code - Thank you!: Sub Email2() ' Keyboard Shortcut...
  5. D

    VBA to create a folder name with the date for Monday and Friday separated by a hyphen?

    Hi Folks, I have found a great macro which allows you to check for the existence of folders in a file-path matching: Year, Month and Day (i.e., creating the folder if it doesn't exist). For instance, if the FilePath starts: C:\Temp Time Sheets\ it checks for C:\Temp Time Sheets\2019\ C:\Temp...
  6. S

    Copy contiguous columns, paste to non-contiguous columns

    Hi there, I have a workbook with integers stored in 6 contiguous columns and 3 rows. ("source WB") For example: A1:F3. However, this range changes from week to week, so the selection of the source range needs to be dynamic. I have another workbook ("destination WB") where I want to paste...
  7. D

    Userform with listbox and checkboxes

    Hello! I am trying to create a user form that makes a user select a name from a Listbox and two options from checkboxes and returns the average of "days" and "amount" for that name selected from the listbox . I'm new to VBA and having trouble setting up the code to do so. Does anyone have any...
  8. D

    For each listrow - update data

    HI! I'm a beginner (at best) with VBA loops and would need to adjust data in Excel table rows, depending on a single column cell value. I want to loop through all rows for this table and adjust data depending on value in 3rd column ("Check"). If column "Check" value is 1, insert value "Disable"...
  9. D

    Copying data from cells onto multiple workbooks VBA error

    Hello, I can't seem to get my module 8 to paste the values of Sheet1 (workbook where the VBA code is) onto another workbook's cells, I will briefly explain my code: I have three workbooks, one workbook (with Sheet1 being the "Operator" sheet) where the VBA code is written in, and another two...
  10. mehidy1437

    How to get the opposite cell details from range in VBA?

    Hi If my selection range is a1: e5 then with below, we can have the first cell as fCell is a1, and last cell as lCell is e5. But what if, i want to get the first column last cell as fColLastCell is a5, and last column first cell as lColFirstCell is e1? Range can be vary time to time. Its not...
  11. P

    VBA to List of Cells Inside Area of Freeform Shape

    Hi I have hard time solving this: I have one Freeform Shape and I need to create VBA which will enlist all cells inside of this Freeform Shape. What is the best way to do it? Thank you very much Victor
  12. T

    Columns to rows

    Hello all, I am hoping somebody can help me fix and speed up the VBA below. My intent is to make Columns "T" to "Last Column with data" become rows. and the VBA i have below is just not working very good and its very slow Current: Sub Columns_2_rows() Dim rownum As Long Dim rownum2 As...
  13. D

    How do I change the selection in a For loop?

    I'm trying to put a string together, compiling the words in A1:C8, by column. The output for the first column output is A10, the output for the second column is B10 etc. and I want the selection to change each time too so that it only includes column A in the A10 output, column B in the B10...
  14. E

    VBA Auto Filter and Copy Paste to a New tab then rename the tab

    Hi to all, I am a newbie and is learning a lot from this site. I am also hoping that someone can help me with my problem with the VBA code I created via recording a macro. I have a 9 column master data that I need to filter based on column C "Department" there are times that two departments...
  15. Y

    VBA excel dates to outlook meetings - ignore blank cells

    Hey everyone, I'm having a lot of trouble getting my head around VBA and I'm very stuck on this particular issue. The code does excatly what i need it to, up until " Set RequiredAttendee = .Recipients.Add(Cells(i, 7).Value) " where some of the cells in that range are blank and I need it to...
  16. T

    VBA Error Handler - How to test

    Hi All Can anyone suggest a simple line of code that will generate an error in order to test out a "On Error Goto" code? Thanks Tom
  17. D

    How do I change the output destination in a For loop

    I'm currently trying to put a string of cells together in a and complete it across several columns but I can't figure out how to change the destination for the output each time Sub test() Dim x x = 7 For x = 7 To 595 Dim rng As Range Dim i As String For Each rng In Selection i = i & rng Next...
  18. P

    Workbooks.Open in VBA - Getting Password Popup Window

    I have the below code, which I will use to open a file. I will then gather data about the file and report back in a master workbook. My issue comes when I am trying to open a file which has a password: The first Workbooks.Open method presents me with a pop-up window, which I expect, although I...
  19. P

    Selecting cells by color in VBA

    I would like to select all cells in the dataset A2:F156 where the color index is 19 (light orange) or 40 (dark orange). I have uploaded a picture of my dataset below. I have compiled the following code: Sub SelectByColor Dim cell as range, rng as range Set rng = range("A2:F841") For each...
  20. P

    Conditionally format the last cell in each row with valuable data

    I have a dataset for wells and 5 treatment plants (TP1, TP2, TP3, TP4, and TP5), which extends from A1 to F841. The flow path for each well is such that the well flows to TP1, then TP2, and so on. However, sometimes the flow path does not extend all the way to TP5. I have manually entered "None"...

Some videos you may like

This Week's Hot Topics

Top