Does anyone know of a macro that will insert quotes around contents of a cell?
Thanks,
Kara Peterson
Does anyone know of a macro that will insert quotes around contents of a cell?
Thanks,
Kara Peterson
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
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
>
>
>
Hi Norman,
Why did you make this a "Public Sub AAA()"
rather than a "Sub AAA()" ?
Dave
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
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
Originally Posted by Norman Jones
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks