Writing VBA for Inserting Text in a multiple cells.

sirmacademy

New Member
Joined
Aug 12, 2018
Messages
17
I want to insert in a cell a text "Saturday" and "Sunday" but I find it difficult to find the pattern inserting it.

Thank you for your help.
 
Hi Jackdanice and Rcik, thank you very much for the code. But the code is running #value for the empty cell. Hoping you may give me another way of leaving it empty if its empty cell or no data. Thank you in advance.
 
Upvote 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hi Jackdanice and Rcik, thank you very much for the code. But the code is running #value for the empty cell. Hoping you may give me another way of leaving it empty if its empty cell or no data. Thank you in advance.

The second macro (named M3) that I posted in Message #9 did not work correctly for you when there were blanks???
 
Last edited:
Upvote 0
Sir Rick the M3 works, but it moves and add the column to the right.
Okay, so now I think we are back to my original confusion over your use of the word "insert". What is being inserted where?

Also, in what you wrote above... what exactly do you mean by "it moves"? What moved?

And what do you mean by it "add the column to the right"? The output from M3 went into Column C... you said in Message #3 "I want to insert in C3, C9 C10, C16 C17, C23 C24, C30 C31" (although you did not explain what you meant by "insert") so what was wrong with where I outputted my Saturday/Sunday text values.
 
Upvote 0
Sir Rick this is the sample format:
[TABLE="class: outer_border, width: 300, align: left"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Date[/TD]
[TD]am in[/TD]
[TD]am out[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2016-02-03[/TD]
[TD]07:30[/TD]
[TD]12:30[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2016-02-04[/TD]
[TD]07:45[/TD]
[TD]12:33[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2016-02-05[/TD]
[TD]08:40[/TD]
[TD]12:14[/TD]
[/TR]
</tbody>[/TABLE]








After the M3()

Sir Rick this is the sample format:
[TABLE="class: outer_border, width: 300, align: left"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Date[/TD]
[TD]am in[/TD]
[TD]am out[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2016-02-03[/TD]
[TD]Saturday[/TD]
[TD]07:30[/TD]
[TD]12:30[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2016-02-04[/TD]
[TD]07:45[/TD]
[TD]12:33[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2016-02-05[/TD]
[TD]08:40[/TD]
[TD]12:14[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]








May you help me again in solving this problem. I want it this way.
[TABLE="class: outer_border, width: 300, align: left"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Date[/TD]
[TD]am in[/TD]
[TD]am out[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2016-02-03[/TD]
[TD]Saturday[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2016-02-04[/TD]
[TD]Sunday[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]2016-02-05[/TD]
[TD]08:40[/TD]
[TD]12:14[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]









Only Saturday and Sunday. No time after OUT
PS: Thank you Sir for the unending patience and help.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top