debug.print

  1. G

    Why is Excel VBA letting me multiply strings?

    I WANT Excel to tell me that I can't multiply a string. What am I missing? Option Explicit Sub why() Dim myVariable As String Debug.Print VarType(myVariable), TypeName(myVariable), myVariable myVariable = 42 'Not "42" myVariable = myVariable * 3 '126 Why? Debug.Print VarType(myVariable)...
  2. D

    VBA Message help

    Hi All, I have used the following code I found online in my current project so that if the file it is trying to write to is being read by someone else, then it displays a prompt. It keeps on re-trying until the file is no longer read only. Finally it will write and save to the file and display a...
  3. AlphaFrog

    Int function rounds down the integer 2 down to 1

    I don't understand why the Int function rounds down the value of 2 down to 1 in the second calculation? Sub Foo() 'Correct result = 2 Debug.Print (0.15 - 0.07) / 0.04 'Why does Int round down the result of 2 to 1 ? Debug.Print Int((0.15 - 0.07) / 0.04) 'Yet...
  4. B

    Excel VBA Delete Visible Cells Big Data

    Dear Sir/Madam, I have about 1M rows. After filtering I have about 150K areas. Deleting the visible cells after filtering is not working. Dim aStartTime Const DblSpace As String = vbNewLine & vbNewLine Const CoName As String = "Silence" Dim wbTarget As Worksheet Dim bErrorHandle As...
  5. B

    VBA - Reference Microsoft XML, v6.0 DOMDocument60.async

    Hi - There is a property DOMDocument.async which when set to true, the default, it is supposed to allow processing to continue and return control to VBA while DOMDocument.load (tried loadXML as well) runs. Tried a couple of different ways after searching. One is posted at...
  6. M

    Find Last Cell after 2 blanks cells - working down

    First thanks in advance for any advice. I have a reviewed a lot of examples that selects the last row working from bottom up. The main issue I have is that I have a column of data that starts at row 20 and I need to determine the last cell when the loop hits the second blank row working down...
  7. J

    Scraping Website Elements

    I received some incredible help from here the first time I posted and I am back with another question related to web scraping. I mainly just need the status result and delivery/projected delivery date. I have figured out a way to loop through these results however some of the load numbers...
  8. S

    Who called this method?

    Is there a way to identify which method calls another. I have a method called from several others. I would like to know which caller it was. Application.Caller is not for this. I want to do something like this. Debug.Print "In write data method." & WhoCalledIt Thanks,
  9. V

    Code is not working

    Hello Experts - I have below code which transfers the file (Gross Contribution Report) inside the subfolder (and override the same file inside this subfolder). However, nothing is happening whenever i'm running below code. Can someone help me understand what's wrong. For visualization purposes...
  10. M

    PowerPivot VBA to enumerate measure format info

    What is the best way to enumerate the measure formats in a data model? Before I develop some truly awful VBA I want to check with this forum. Enumeration of the measure info itself is pretty straightforward... Dim objMs As ModelMeasures Dim objM As ModelMeasure Dim objMName As...
  11. B

    Items not being added to dictionary

    Hi All, I have the below which is supposed to be adding a range of text values to a dictionary however when I debug.print it nothing is being added. list1 is defined as a variant. Set d = CreateObject("scripting.dictionary") list1 = ThisWorkbook.Sheets("Summary").Range("A7:A22").Value For...
  12. 3

    Setting Global Variables

    Hi, I'm trying to set global variables for final row of a region of each sheet I have. I have the following code. However, when I debug.print - nothing prints out. Could someone points out my error or how I go about setting global variables that I could reuse in different procedures within the...
  13. G

    Import multiple .csv files with variable names

    Hi, This thread is the result of an older one, which started out as a problem with column headers but turned into a headache with csv files ...... I have a folder with .csv files that go back 12 and even more months in the past. Every day the system I work with will create 4 new files and...
  14. A

    Structuring a Statement and Removing Columns

    Hello, I am having an issue with my IF statement below involving removing columns and that it ends up not removing all the columns it should. When I do a debug.print it finds the correct columns to remove however when it actually runs it's not removing them all. I figured out it's because as it...
  15. A

    Font Colour in Comment

    I believe this changed in Excel 2007 (from 2003) where this worked .Characters(1, l).Font.Color = RGB(153, 51, 0) I thought it was now .Font.ColorIndex but that didn't work either. Also, is there any way to debug.print all elements before ".Characters" to check what they are? Thanks.
  16. N

    VBA - Trying to find my error

    I have the following code: Debug.Print InStr(1, ActiveCell.Offset(0, 14).Value, "1", vbTextCompare) = 0 Debug.Print InStr(1, ActiveCell.Offset(0, 14).Value, "2", vbTextCompare) = 0 Debug.Print InStr(1, ActiveCell.Offset(0, 2).Value, "3", vbTextCompare) = 0 Debug.Print InStr(1...
  17. G

    VBA Find failure

    Test code: Option Explicit Sub SearchTest() Dim Search As Range Dim MyRange As Range Set MyRange = Worksheets(1).Range("A1:A8") Set Search = MyRange.Find(What:="0", LookIn:=xlValues) Debug.Print Search.Row Set Search = MyRange.Find(What:="00", LookIn:=xlValues)...
  18. R

    vbscript variable to excel

    I've got a vbscript that passes a variable to excel. It currently and successfully can deliver a single value to excel. I'm attempting to send an array; not having any luck. The excel code receives the variable and debug.print confirms the variable is an array, but as soon as you try to access...
  19. B

    For Loop not passing caption from a listbox to an array

    Greetings, I’m having an issue wherein a for loop isn’t passing the caption from a listbox to an array. When I add the variable SheetsFound to the Watch window, the value is always empty yet when the loop evaluates whether listbox value is check or unchecked, it verifies which listbox value is...
  20. J

    Is This AutoSave Macro Correct??

    I get errors cannot run or check security settings. Private Seconds As Integer Private Sub Workbook_Open() Seconds = 10 ' 5 minutes. Adjust as you wish ScheduleSaving End Sub Sub ScheduleSaving() Application.OnTime Now + Seconds / 24 / 3600, "ThisWorkbook.SaveMyWorkbook", Now...

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