VBA for update a cell based off another cell

Helloitsmemargaret

New Member
Joined
Jan 27, 2015
Messages
4
Hi I am unable to get my macro to work to update one cell based off another cell. I need " Escalated to Issue" cells in Column N to transform "Risk" value cells in Column H to "Issue" value cells in Column H.
Can someone help :)

This is what I have

Sub Test()
Dim LastRow As Long
Dim i As Long
LastRow = Range("N" & Rows.Count).End(xlUp).Row
For i = 3 To LastRow
If Range("N" & i).Value = "Escalated to Issue" Then
Range("H" & i).Value = "Issue"
End If
Next cell
End Sub
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
A couple of things to consider, case-sensitivities
Put this line before your SUB.
Code:
Option Compare Text 'ignore text case
Next, the potential the user input an extra space in "Escalated to Issue" so instead of an exact match, just a string match like this
Code:
If instr(Range("N" & i).Value, "esca") then
 
Upvote 0
A couple of things to consider, case-sensitivities
Put this line before your SUB.
Code:
Option Compare Text 'ignore text case
Next, the potential the user input an extra space in "Escalated to Issue" so instead of an exact match, just a string match like this
Code:
If instr(Range("N" & i).Value, "esca") then

What would be the exact VBA utilizing this?
 
Upvote 0
Maybe you need to refer to the sheet...and remove the .value since you are working with Text.
See example below, change sheet1 to whatever you need.

Ahhhh...as I was proof reading I noticed you had "Next cell" it should be Next i because i is the loop.

Rich (BB code):
Sub Test()
Dim LastRow As Long
Dim i As Long
LastRow = sheet1.Range("N" & Rows.Count).End(xlUp).Row
For i = 3 To LastRow
If sheet1.Range("N" & i) = "Escalated to Issue" Then
sheet1.Range("H" & i) = "Issue"
End If
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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