+ Reply to Thread
Results 1 to 3 of 3

Debug.Print Error

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    696

    Debug.Print Error

    Hi,

    Can anyone help me?

    I just want to print value in each worksheets but got error.

    Sub xy()
        
        For Each ws In ActiveWorkbook.Worksheets
        Debug.Print ws.Name & " " & ws.Name.Range("AR601").Value
        Next ws
    
    End Sub

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Debug.Print Error

    Hi, Faridwahidi,

    ws is set for the worksheet and Name is part of ws so omitt the name part:
    Sub xy()
        
        For Each ws In ActiveWorkbook.Worksheets
        Debug.Print ws.Name & " " & ws.Range("AR601").Value
        Next ws
    
    End Sub
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Valued Forum Contributor
    Join Date
    03-28-2014
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Debug.Print Error

    Hi Ciao,

    Thanks a lot.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA Code Runs in Debug Mode But Returns Type Mismatch Error Outside Debug Mode
    By valerie.k.chiang in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2014, 03:48 PM
  2. What does Debug.Print do?
    By KRAND in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-12-2013, 04:39 AM
  3. Debug.Print for variables
    By Jiptastic in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-09-2012, 10:18 PM
  4. Debug.Print Problem
    By jhl84 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 09-24-2007, 04:07 AM
  5. [SOLVED] question about debug.print
    By Gary Keramidas in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-28-2005, 09:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1