Need help with VBA code to enter specific content in a fixed number of cells

Excel_Girl

New Member
Joined
Jan 19, 2019
Messages
6
Hi,

Can someone please help me with a VBA code for the following:

1. Suppose I have around 1000-2000 email ids in Column A
2. I need to assign content for eg. "Car" to half of these ids in Column B and "Motorbike" to the other half.

Appreciate any help!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
what does some of the data look like
 
Upvote 0
Excel_Girl,

Welcome to the MrExcel forum.

It is always easier to help and test possible solutions if we could work with your actual file.

Perhaps you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com.

Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here.

Include a detailed explanation of what you would like to do referring to specific cells and worksheets.

If the workbook contains confidential information, you could replace it with generic data.
 
Upvote 0
what does some of the data look like

[TABLE="width: 300"]
<tbody>[TR]
[TD]djajdjajd@gmail.com[/TD]
[TD]Car[/TD]
[/TR]
[TR]
[TD]adkdkdkd@gmail.com[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]adkdkdkd@gmail.com[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]adkdkdkd@gmail.com[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]kda;kdfa;lkdsjf;@gmail.com[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]dkjfalkdfjalsf@gmail.com[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]a;ldkjfas;lkdfk@gmail.com[/TD]
[TD]Truck[/TD]
[/TR]
[TR]
[TD]lkdf;lkasjdf@gmail.com[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ddkdkakd@gmail.com[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]akdkdkdk@gmail.com[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

In Column B, I need to assign content such as "Car" or "Truck". For example, sometime I will need to assign "Car" to 60% of the time and the rest should be "Truck". At other times, I may need to fill 50% of Column B cells with "Car" and the rest with "Bike".

Can you pls help me with a VBA code for this?

Thanks!!
 
Upvote 0
Excel_Girl,

Welcome to the MrExcel forum.

It is always easier to help and test possible solutions if we could work with your actual file.

Perhaps you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com.

Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here.

Include a detailed explanation of what you would like to do referring to specific cells and worksheets.

If the workbook contains confidential information, you could replace it with generic data.


Sure, I will do that. Thanks
 
Upvote 0
what makes

[TABLE="class: cms_table, width: 300"]
<tbody>[TR]
[TD]djajdjajd@gmail.com
[/TD]
[TD]Car
[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]a;ldkjfas;lkdfk@gmail.com[/TD]
[TD]Truck[/TD]
[/TR]
</tbody>[/TABLE]

you have no logic there at all as far as i can see
 
Upvote 0
Okay here is the logic. Every week, I need to send marketing emails to a few email ids (usually 1000-2000). Now, I need to send "Car" related email to half of the email ids and "Truck" to the other half. I need to first fill in Column B as "Car" or "Truck" for our record, so that we dont repeat sending the same product email twice.
 
Upvote 0
Okay here is the logic. Every week, I need to send marketing emails to a few email ids (usually 1000-2000). Now, I need to send "Car" related email to half of the email ids and "Truck" to the other half. I need to first fill in Column B as "Car" or "Truck" for our record, so that we dont repeat sending the same product email twice.
 
Upvote 0
OK, so maybe you need a RANDOM Generator to do that. It wasn't evident that it is a form of cold calling. Don't do it in the UK
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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