VBA Macro to automate a tedious task - fast help needed

alombia

Board Regular
Joined
Jan 14, 2016
Messages
89
Hello guys,

I am doing some tedious data entry work on excel. Please have a look at the following image:

s!AjRsGvCIFWX7iC3muzUDdj1RAckz
s!AjRsGvCIFWX7iC3muzUDdj1RAckz
y4mlTiQDTq3t30MqGuwskhGT5ZElUv7009Cv4sRSS0_NsrHVIwGiHrgcbefBqtre1UKbv_cVWvyprEqbU9lbQE8QZB5fGcIN8SldrVLGM497BDTiFSP3Z3tigYpz55lPrNNUBfOs5whqEiMYoUBi3C0aN11yUhDzS7es-r92nQKmm5IZRyWCsoBGoV-QGt6P8Z5UpdSYNxRtEujn_q6fhJqog

I have been given the task of creating a huge number of excel files. My task is to:
1. Copy and past data (which is "a,b,c,d") into cells J5:J24 as shown above.
2. Based on the abcd value of J5:J24 I am to insert an 'X' into cells F5:I24 as shown above.

My question: how can i create a vba macro to automate this inserting 'X' into the relevant cells. i.e if J5=a then insert X in F5 else if J5=b then insert X in G5 else if J5=c insert X in H5 else if J5=d then insert X in I5 etc and then continue this if/ese until J24

Your help will be immensely appreciated.

Thanks in advance.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Try This:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG09Sep53
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Set[/COLOR] Rng = Range("J5", Range("J" & Rows.Count).End(xlUp))
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
    Dn.Offset(, -(69 - Asc(UCase(Dn.Value)))) = "X"
[COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,214,952
Messages
6,122,457
Members
449,083
Latest member
Ava19

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