Can some one help me with a VBA Code

mchapman123

New Member
Joined
Mar 20, 2011
Messages
1
I found a code through the forum search that will allow you to define what text you want to insert in front of cells that are already populated. example
I have a column of picture names and I want to insert the url for each picture. so I used

Sub test()
With Range("t2", Range("t" & Rows.Count).End(xlUp))
.Value = Evaluate("if(" & .address & "<>"""",""www.abc123.com/v/vspfiles/photos/manufacturer/ ""&" & .address & ","""")")
End With
End Sub

and this puts the url infront of my picture names, so t2 that was 90009.jpg becomes www.abc123.com/v/vspfiles/photos/manufacturer/90009.jpg

but what would be the reversal of this allowing me to put text behind the text that are already in the cells.

I am new to this and do not understand what in the code determines whether the text will insert infront or behind the data already in the cell. Thanks !!
 
Last edited:

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Try this:- One for "Before " and One for "After".
Code:
With Range("A1", Range("A" & Rows.Count).End(xlUp))
.Value = Evaluate("if(row(), ""Before Cell Value /"" & " & .Address & ")")
End With
Code:
With Range("A1", Range("A" & Rows.Count).End(xlUp))
.Value = Evaluate("if(row(), " & .Address & " & ""/After cell Value"" " & ")")
End With
Mick
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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