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.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]a[/TD]
[TD]b[/TD]
[TD]c[/TD]
[/TR]
[TR]
[TD]node1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]node2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]node3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]node1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]node4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
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,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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