VBA Formula Question

  • Thread starter Thread starter syrOrange
  • Start date Start date
S

syrOrange

I want to input the below formula's into a couple of ranges

Column A1 contains various information that include a "&" in the range
Range B1 through C10 I want to input

=find("&", A1) GOES INTO B1
=mid(A1, B1+1, 5) GOES INTO C1

Then this is copied down until row 10

I can't seem to get it right.
 
I'm assuming your issue is how to write it using VBA (the post titl
says that, but the post doesn't). Here's how I would do it:

Sub test()

Dim i As Integer

For i = 1 To 10
Range("B" & i).Value = "=FIND(""&"", A" & i & ")"
Range("C" & i).Value = "=mid(A" & i & ", B" & i & "+1, 5)"
Next

End Sub

One of the keys is to notice that to acutally print a double quot
rather than using it as a string container, you must double it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top