ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to add " (https://www.excelbanter.com/excel-programming/379760-macro-add.html)

Rebecca Plumridge

Macro to add "
 
I have an entire worksheet that I now need to add " (an apostrophe) to the
start of each cell and " to the end of it to enclose the text within. Is it
possible to create a macro for this?

Any help would be greatly appreciated.

Thanks

ankur

Macro to add "
 

Hi Rebecca,

Select the target range and
Try this...

Sub test()
Dim cell As Object

For Each cell In Selection
If cell.Value < "" Then
cell.Value = """" & cell.Value & """"
End If
Next cell
End Sub

Regards
Ankur Kanchan
www.xlmacros.com


On Dec 20, 11:13 am, Rebecca Plumridge <Rebecca
wrote:
I have an entire worksheet that I now need to add " (an apostrophe) to the
start of each cell and " to the end of it to enclose the text within. Is it
possible to create a macro for this?

Any help would be greatly appreciated.

Thanks



Rebecca Plumridge[_2_]

Macro to add "
 
Thanks so much!! Worked first time and saved me hours of grief!!

"ankur" wrote:


Hi Rebecca,

Select the target range and
Try this...

Sub test()
Dim cell As Object

For Each cell In Selection
If cell.Value < "" Then
cell.Value = """" & cell.Value & """"
End If
Next cell
End Sub

Regards
Ankur Kanchan
www.xlmacros.com


On Dec 20, 11:13 am, Rebecca Plumridge <Rebecca
wrote:
I have an entire worksheet that I now need to add " (an apostrophe) to the
start of each cell and " to the end of it to enclose the text within. Is it
possible to create a macro for this?

Any help would be greatly appreciated.

Thanks





All times are GMT +1. The time now is 08:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com