1. J

    Macro for creating a folder

    Hi I have below code for creating a folder in the same directory as the active workbook. The folder name should be the content of the selected cells when I run the macro. However, I get an error "Bad file name or number (Error 52)" on this code line when debugging: If Len(Dir(ThisWorkbook.Path...
  2. A

    Macro only works in debug mode

    Hello all, I'm attempting to run a macro over multiple workbooks which clean up, and add additional data into each workbook. For the most part, this macro runs correctly, however, one section will only run properly if stepped through in debug mode. If run normally it will have no effect. What...
  3. M

    Mega Quick VBA Amendement

    Afternoon all, Really quick one. I have some code (below) that generally works fine (to filter sheets), however, I don't want it to run on a new sheet called 'Summary' and I am getting a debug error. Can someone add a line to basically say 'ignore Summary sheet' and run only on "Sheet 1"...
  4. Rijnsent

    Overflow - why?

    I'm a bit stumped: why does VBA behave like this? See the Sub below: when I simply Debug.Print 60*24*2*60, I get an Overflow error. So apparently VBA treats that multiplication as an integer and therefore fails as it's too big. But why do the tests after that fail and why do the last two...
  5. 7

    VBA - really no solution for effectively debug locked code?

    Dear VBA experts and fans, I created an excel system that is full of VBA code and we give it to the client - with the code locked for viewing. Of course, there was soon a request that the client encountered an error, so I put "bookmarks" into the whole code - I divided the code into parts...
  6. S

    new in macro

    Hi all, i am just started to use macro recently , and i face issue after creating the macro it worked fine for few days then it bring Debug error message although i didn't make any change in it, any advice?
  7. S

    debug print help

    If I wanted/hoped to have a screenshot of the exact error (specifically the highlighted line) of code and to save it in a file on my desktop. I am not exactly sure how to do this and was hoping I could get some help. Thanks!
  8. C

    Excel Debug

    Having an issue trying to debug someone's work, don't know this style of coding well and so not sure what is wrong here exactly but the error it says is user-defined type not defined, and I tried fixing this by defining it as a different declaration and that didn't work. ' Connect to the...
  9. M

    Debug tabs name to correspond with cell value.

    Hi, I have this code that worked in another program but now that I use it in a new one, it converts all the tab names to dates except for the last three ones. The only thing that I changed was the tabs number. The old one was from 11-22 this one is 9-20 Private Sub Worksheet_Change(ByVal...
  10. O

    IF AND OR combo

    I just cannot seem to get this right today. I'm trying this: =IF(AND(E4=0,D4>0)*OR(C4>D2),"New",IF(AND(E4>500,D4>500),"Mature","Winding Down")) Not giving me what I want. I want if E4=0 and D4>0 or if C4>D2 to give me "New". If E4>500 and D4> 500 give me "Mature" otherwise "winding down"...
  11. J

    Worksheet change events stop working after Debug?

    Hi, I'm sure some of you have come across this. If for example I have a worksheet.change event that writes values to cells. Then for any reason I get a debug error in VBA. The worksheet events stop working until you close/reopen the workbook (well the only way I know of) Anything I'm missing...
  12. R

    Code works in debug mode but fails to run in compile mode

    Hi all I am writing a VBA code to copy charts from Excel to Powerpoint. The code is running fine in debug mode, however, gives an error in compile mode. Can anyone please help? Thanks in advance. MBSheet.Activate MBSheet.ChartObjects("Chart 1").Chart.ChartArea.Copy mySlide.Select With...
  13. S

    Macro Debug Error (Deleting a row)

    Hello, I want to delete all rows if column N reads "NULL". I was given the last two lines of this macro a while back from someone (I believe from this forum) and it has worked in the past. I applied this to my current macro but I am getting a debug error when I get to the last 2 lines. Can...
  14. W

    Run-time Error 1004

    I have copied VBA code from the internet and edited myself to create some invoices, Every time I run the code I get the above error and ask me to debug. Can someone please help me??
  15. B

    Sort leading to debug error... any thoughts?

    I have the following code working as part of a macro without any issue... of course, when I get to my client, I get a debug error... The topRow and botRow variables are storing numbers and in debug mode, when I hover over them, the correct numbers are showing. Any thoughts on a better way to...
  16. J

    VBA Causing Debug Issues

    I am using the below code. However, when I delete any contents from any cell I am getting a debug error. Can't figure out why. Private Sub Worksheet_Change(ByVal Target As Range) 'search If Target = Range("Q11") Then If InStr(1, Range("Q11"), "Search") > 0 Then Search End If End...
  17. I

    Change all to proper case using VBA - Office 365

    Ok so I am trying to automatically have my form in excel change things to proper case when entered. I found a code that works but then seems to crash excel or kick me to debug here is what I have please help in fixing it so it works. Private Sub Worksheet_Change(ByVal Target As Range) 'Update...
  18. E

    Run-time error 1004 - No cells were found

    Hi all, Hoping someone can help! When running the macro below, I am getting a run-time error 1004 - No cells were found error. I have tried diagnosing this issue myself, but am at a loss. This macro worked perfectly on the worksheet it was originally created on. So I used that worksheet as a...
  19. E

    Runtime error 1004 when running a macro

    Hi everyone, When running a macro, I am getting the following runtime error: Run-time error '1004': Method 'Range' of object '_Worksheet' failed When I click 'Debug', it takes me to the line of code that isn't working, which is highlighted in blue below: Dim ary As Variant Dim i As Long...
  20. H

    Debug error

    My spreadsheet takes totals and subtracts totals. I have about 6 columns and rows that are filled with data. If I try to insert a new row I get a debug error. The debug highlights "Application.Undo" Not sure why any suggestions? Private Sub Worksheet_Change(ByVal Target As Range) 'copies the...

Some videos you may like

This Week's Hot Topics