Change cell value and move to next row VBA loop

kfahnty

New Member
Joined
Nov 12, 2018
Messages
3
Hi,

I am very new to VBA and I am trying to automate some processes in my day job.

I am trying to write a code to check:
  • if cell J2 value ="Additional" then
  • change to "="
  • if else leave as "Additional"
  • then I want it to move to cell J3, J4 and so on, until the last row.

I've tried several iterations of Loops and If statements but nothing seems to work. Can someone post a sample code that can help me with this?

Thank you!!
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hi & welcome to MrExcel.

Not sure if I've understood you correctly. Are you saying the if J2 is "Additional" then clear J2, otherwise write "Additional" in J2?
 
Upvote 0
Hi & welcome to MrExcel.

Not sure if I've understood you correctly. Are you saying the if J2 is "Additional" then clear J2, otherwise write "Additional" in J2?

Hi, sorry, I've made a mistake. If J2 is "Additional" then clear, otherwise leave as is. Hope that clarifies it.
 
Upvote 0
Ok, how about
Code:
Sub ClearSome()
   With Range("J2", Range("J" & Rows.Count).End(xlUp))
      .Replace "Additional", "", xlWhole, , False, , False, False
   End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,834
Members
449,051
Latest member
excelquestion515

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