How to repeat the macro for all cells in a column with reference to the adjacent column cell is not empty

raghavanhr

New Member
Joined
Aug 29, 2018
Messages
5
Dear Friend,

Please help me to run the macro for all cells of a particular column, with reference to the adjacent cell till it is not an empty cell.

eg. column I refers to the cell value to execute the Macro in column J.

If the cell value of I =0, J value should be as "Can issue" else "Material Return Pending"

I have written the macro as below


"Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Range("I2").Value = 0 Then
Range("J2").Value = "Can Issue"
Else
Range("J2").Value = "Maretial Retun Pending"
End If
End Sub
"

I don't know how to attach my excel sample file.

pasted below the values of my excel

SR.NODATEID NO.PART. IDDESCRIPTIONUOMISSUE QTYRETURN QTYNEW ISSUEMaterial Issuance CheckSHIFTPROJECTREMARKS
102/02/201980181000000499EAR PLUGNOS110Can IssueDAYJF1801
202/02/2019135381000000499EAR PLUGNOS110DAYJF1801
302/02/2019168482100000040WHITE MARKERNOS101DAYJF1801
402/02/201989481000000219TWECO CONNECTOR 120MM MALENOS202DAYJF1801
502/02/201989481000000219TWECO CONNECTOR 120MM FEMALENOS202DAYJF1801
602/02/201995276020000007DOTTED GLOVESPAIR110DAYJF1801
702/02/201995281000000499EAR PLUGNOS110DAYJF1801
802/02/201995281000000529GRINDING DISC 7''NOS110DAYJF1801

<tbody>
</tbody>
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

jim may

Well-known Member
Joined
Jul 4, 2004
Messages
7,484
Have you considered a formula in Cell J2 (and Copied Down) like - Macro Not Needed!!
Code:
[TABLE="width: 173"]
<tbody>[TR]
[TD="class: xl63, width: 173"]=IF(I2=0,"Can  Issue","Material Retun Pending")[/TD]
[/TR]
</tbody>[/TABLE]
 

raghavanhr

New Member
Joined
Aug 29, 2018
Messages
5
Hi Jim,

I want that J2 column with a comment to be blinking if it is Material Return Pending, else the store guy can issue the material. This is to enhance my material issuance track.

kindly advise.
thanks,
Vijay.
 

raghavanhr

New Member
Joined
Aug 29, 2018
Messages
5
I don't have any formula in J2, but with reference to the value in "I" column, called the comment in J column by a macro.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,487
Messages
5,831,972
Members
430,099
Latest member
rdhoy

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
Top