+ Reply to Thread
Results 1 to 6 of 6

Macro inserting quotes "" in a cell

  1. #1
    Kara
    Guest

    Macro inserting quotes "" in a cell

    Does anyone know of a macro that will insert quotes around contents of a cell?

    Thanks,
    Kara Peterson

  2. #2
    Norman Jones
    Guest

    Re: Macro inserting quotes "" in a cell

    Hi Kara,

    Try:
    '=========>>
    Public Sub AAA()
    With ActiveCell
    .Value = """" & .Value & """"
    End With
    End Sub

    '<<=========

    ---
    Regards,
    Norman



    "Kara" <[email protected]> wrote in message
    news:[email protected]...
    > Does anyone know of a macro that will insert quotes around contents of a
    > cell?
    >
    > Thanks,
    > Kara Peterson




  3. #3
    chijanzen
    Guest

    Re: Macro inserting quotes "" in a cell

    Another method

    With ActiveCell
    .Value = Chr$(34) & .Value & Chr$(34)
    End With


    --

    http://www.vba.com.tw/plog/


    "Norman Jones" wrote:

    > Hi Kara,
    >
    > Try:
    > '=========>>
    > Public Sub AAA()
    > With ActiveCell
    > .Value = """" & .Value & """"
    > End With
    > End Sub
    >
    > '<<=========
    >
    > ---
    > Regards,
    > Norman
    >
    >
    >
    > "Kara" <[email protected]> wrote in message
    > news:[email protected]...
    > > Does anyone know of a macro that will insert quotes around contents of a
    > > cell?
    > >
    > > Thanks,
    > > Kara Peterson

    >
    >
    >


  4. #4
    Forum Contributor
    Join Date
    02-26-2005
    Posts
    175
    Hi Norman,
    Why did you make this a "Public Sub AAA()"
    rather than a "Sub AAA()" ?
    Dave
    Quote Originally Posted by Norman Jones
    Hi Kara,

    Try:
    '=========>>
    Public Sub AAA()
    With ActiveCell
    .Value = """" & .Value & """"
    End With
    End Sub

    '<<=========

    ---
    Regards,
    Norman



    "Kara" <[email protected]> wrote in message
    news:[email protected]...
    > Does anyone know of a macro that will insert quotes around contents of a
    > cell?
    >
    > Thanks,
    > Kara Peterson

  5. #5
    Norman Jones
    Guest

    Re: Macro inserting quotes "" in a cell

    Hi Dave,

    > Why did you make this a "Public Sub AAA()"
    > rather than a "Sub AAA()" ?


    Primarily because of a penchant for explicitness. If the scope of a sub is
    not explicitly specified (as in your second example) it is Public by
    default.

    A public sub procedure is accessible to procedures in other modules;
    conversely, when declared as Private, a sub is accessible only to procedures
    in the same module

    For more information, look at the Public, Private and Sub statements in VBA
    help.


    ---
    Regards,
    Norman



  6. #6
    Forum Contributor
    Join Date
    02-26-2005
    Posts
    175
    Hi Norman,
    Thx for this enlightenment. I knew about the Private Sub, But i thought the Public
    was only for when you want a sub that's in the WorkSheet or WorkBook module
    to be global in the WorkBook. But a Sub in a General Module is Global in the Workbook.

    Thx Much
    Dave

    Quote Originally Posted by Norman Jones
    Hi Dave,

    > Why did you make this a "Public Sub AAA()"
    > rather than a "Sub AAA()" ?


    Primarily because of a penchant for explicitness. If the scope of a sub is
    not explicitly specified (as in your second example) it is Public by
    default.

    A public sub procedure is accessible to procedures in other modules;
    conversely, when declared as Private, a sub is accessible only to procedures
    in the same module

    For more information, look at the Public, Private and Sub statements in VBA
    help.


    ---
    Regards,
    Norman

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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