|
-
Sep 12th, 2012, 09:47 PM
#1
Thread Starter
New Member
[RESOLVED] How to create an Excel Macro for adding text in multiple cells
How do I create a MS Excel Macro that will copy and paste <p> </p> tags in multiple cells within the same column around paragraphs?
Example:
Column B Cell 1:
<p>This is a paragraph that is going to be used in this post as an example. Place the paragraph tags around this.</p>
Column B Cell 2:
<p>This is a paragraph with text used for an example.</p>
And so on.
Paragraphs such as these are in multiple cells within Column B. About 426 cells.
-
Sep 13th, 2012, 05:53 AM
#2
Re: How to create an Excel Macro for adding text in multiple cells
try like
Code:
for each cel in range("b:b")
if isempty(cel) then exit for ' end on empty cel
cel.value = "<p>" & cel & "</p>"
next
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Sep 13th, 2012, 07:12 AM
#3
Thread Starter
New Member
Re: How to create an Excel Macro for adding text in multiple cells
Okay. Thank you. I will give it a try. Do you know any good references for creating these type of macros?
-
Sep 13th, 2012, 08:16 PM
#4
Thread Starter
New Member
Re: [RESOLVED] How to create an Excel Macro for adding text in multiple cells
Thank you. Your code worked today.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|