ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Formula Question (https://www.excelbanter.com/excel-programming/313343-vba-formula-question.html)

syrOrange

VBA Formula Question
 
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.




kkknie[_222_]

VBA Formula Question
 

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.



--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26870



All times are GMT +1. The time now is 11:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com