Help to do Macro: Find a predefined Text, Move one cell right and write a Text

crazysenses

New Member
Joined
Jan 3, 2014
Messages
2
Hello experts, i nned your help im trying to do the following macro.

abc
node1
node2
node3
node1
node4

<tbody>
</tbody>

The macro needs to find the text "node1 ", and move to B1 and write PLATFORM1,
so for the next row, find the text "node2", and move to B2 ant wirte PLATFORM2, then node 3 and move to B3.

I have this

Cells.Replace What:="node1", Replacement:="PLATFORM1"
Cells.Replace What:="node2", Replacement:="PLATFORM2"
Cells.Replace What:="node3", Replacement:="PLATFORM1"
But this replace the content, and i want the new text will wriiten in the next cell.


Thten i try this, but it only execute for the first fild i select and i need to be executed for all the cells i select.


Cells.Find What:="node1"
ActiveCell.Offset(0, 1).FormulaR1C1 = "PLATFORM1"
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
When its NODE3 or NODE4, whats the value in column B gonna be?
 
Upvote 0
This is an example, you use a select case statement and list all the possible cases
Code:
Sub findnode()

For I = 2 To Range("A" & Rows.Count).End(xlUp).Row
    Select Case Range("A" & I).Value
        Case "NODE1"
            Range("B" & I).Value = "PLATFORM1"
        Case "NODE2"
            Range("B" & I).Value = "PLATFORM2"
        Case "NODE3"
            Range("B" & I).Value = "PLATFORM3"
        Case "NODE4"
            Range("B" & I).Value = "PLATFORM4"
    End Select
Next I
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,104
Messages
6,128,856
Members
449,472
Latest member
ebc9

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