target

  1. C

    Dynamically rename worksheet (tab) name based on a cell value

    Hi all, I've inherited a workbook with the following code which renames the worksheet (tab) name as per the contents of a given cell, say cell A1. Private Sub Worksheet_SelectionChange(ByVal Target As Range) Set Target = Range("A1") If Target = "" Then Exit Sub Application.ActiveSheet.Name =...
  2. Y

    VBA Copy and Paste

    The following code does one of three things 1. Copies 3. Pastes 2. If copy and paste have already been done, the Double click transfers you to the event sheet. I use a counter in "A1" to establish what we are doing (1 or zero) My problem is, that if someone starts the process, with a zero and...
  3. A

    VBA Update a sub set of records

    I am using the following macro to place a "w" in column M (9) of the target record of a worksheet when colmun D gets the entry "Filled". Dim lastrow As Integer lastrow = Range("D" & Rows.Count).End(xlUp).row 'If Status is "Filled" place a "w" in Results 'Range("D2:D" &...
  4. K

    How to get application username

    Hi all, I am using the following but not getting the application username. Can anyone please help me? Thanks Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim r As Excel.Range Set r = Union(Range("A1:A5"), Range("C1:C5")) If...
  5. E

    ByVal Target as Range looking at a formula

    Hi all, I am using the below code which is working perfectly if the value is typed into the target address. However, if possible I want to change the target cell to a formula that pulls through from another sheet. So target address is N2 which is a formula "=sheet1!B2" Private Sub...
  6. C

    Autofilter a table in another sheet based on selected cell value where autofilter needs to be 'contains'

    hi all, firstly i'm not that familiar with VBA so i appreciate any and all guidance i can get from this community with this query I have. So i've referenced this solution 'https://stackoverflow.com/questions/35231790/clicking-a-hyperlink-in-excel-to-set-autofilter-on-a-different-sheet#', which...
  7. I

    How can I calculate a percentage of sales, and then output how many months it took to hit that?

    Hey guys, hopefully someone can help before I get back into work tomorrow... I have a list of ~10 customers, each of which have a target revenue. For all 10 customers I have sales data going from 2013 to date (by month), along with month-to-date sales data for each month. I need to calculate...
  8. J

    Name Sheet Based On Cell Value

    Hi I am trying to name a sheet based on the value of a cell on that sheet. I found the following VBA online... <code class="vb keyword" style="white-space: nowrap; padding: 0px !important; font-family: Consolas, "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important...
  9. I

    Line chart colour change if outside of target

    Evening, I’m putting together a line graph/chart for my diabetes. I’m currently looking to see how it’s possible to change the line colour if outside a certain range target. I mean currently the line is Blue but when I enter a value that’s outside my max range target number then that part...
  10. C

    2 SelectionChange on the same worksheet

    Hello all, I've found quite a lot of usefull tips on this forum by just looking around, but I can't seem to find this answer for this problem. Keep in mind that I have next to no knowledge in VBA of coding in general. I have found two codes that I would like to use simultaneously on the same...
  11. J

    VBA multiple selection

    Is there a way to allow multiple selection delete? Like the user selects more than 1 cell and pushes the delete button without causing an error to a macro? I know to allow multiple selection is something like Target.Count > 1 . How can we incorporate if the user deletes multiple cells? Also...
  12. S

    Adding Graphs

    I'm trying to add a graph representing a target figure, however I want the graph to be a shape e.g. thermometer; that would continue to fill as you get closer to target figure? Any help appreciated. Thanks
  13. M

    Copy rows and change value in cell of row copied

    Hi there, I have some code that loops down column AD and searches for "To be sent", if it finds it, it copies the entire row and pastes into another worksheet. How can I update this so that for every row copied, the cell in column AD is changed from "To be sent" to "Sent"? Thanks...
  14. F

    Auto Format locked cells

    Hi I want to adapt the code below so when the cell has locked after some input the background changes colour The code is Worksheet. Change Private sub worksheet_change(byval target as range) Activesheet.unprotect password:=“blablabla” Target.locked = true Activesheet.protect password :=...
  15. S

    Allowing the cell to be editable after macro.

    I have been trying to use this code, to scan data matrices into excel. They have three lines of data but when scanned they move to three individual cells. This code manages to keep them in a single cell so that multiple can be scanned into it, but it the event of a duplicate or an error, the...
  16. R

    BeforeDoubleClick

    I have a spreadsheet in which I want to perform a BeforeDoubleClick command on. I have two ranges which are M3 to M49 (range 1) and M50 to M250 (Range2). In range one when i perform a doubleclick I want the contents of the cell to change from "NOT CHECKED" to "CHECKED" and the cell colour to...
  17. B

    Dialog Box when different cells are selected

    Hi Mr Excel and hope you can help me please? As a relatively newcomer to VBA, but being quite good with excel, I need to create a form that requires a series of Yes/No inputs (Yes/No drop downs) Based on some of these inputs I need a dialog box to pop up giving guidance to the user of the...
  18. B

    how to add 2 conditions in a if statement

    Hello, I have a code which will check the range for letter "E" and will copy all rows to sheet purchasing. Now i have a need that the macro should check another condition before the rows are copied to sheet 'purchasing' It should check for "E" or "F" in column 'type'. If of "F" my below...
  19. L

    Add a new named range each time a cell changes

    When a cell in the range A1:A100 is changed (added), I want to define a named range that referring to the two cells to the right. The name of the range can be the value of the target cell. I tried the below code but it doesnt work for some reason... Private Sub Worksheet_Change(ByVal Target As...
  20. N

    Excel Drop Down List Automatically Changes Info(multiple) to Code

    I want the ability to create a list using data validation and give it a define name. With this I want a drop down menu that will display a title but once selected give a code. Here is the code I have right now: <code> Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count > 1...

Some videos you may like

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top