excel - Find first vowel in a column and display it in the next column -


what trying basic. want loop through full column "i" , display vowel in column "m". want loop through 1000+ rows in column. here got far, error referencing object-based.

private sub form_load()     dim mystring string, long, asciinum string, f long      f = 1 rows.count         rows(f, "i") = mystring         = 1 len(mystring)             asciinum = lcase(mid(mystring, i, 1))             if asciinum = "a" or asciinum = "e" or asciinum = "i" or asciinum = "o" or asciinum = "u"                 rows(f, "m") = "first vowel " + asciinum                 exit             end if         next         exit     next end sub 

probably error array , for...loop?

you have value assignment backwards , need use cells instead of rows.

option explicit  private sub form_load()     dim mystring string, long, asciinum string, f long      f = 1 rows.count         mystring = cells(f, "i").value2         = 1 len(mystring)             asciinum = lcase(mid(mystring, i, 1))             if asciinum = "a" or asciinum = "e" or asciinum = "i" or asciinum = "o" or asciinum = "u"                 cells(f, "m") = "first vowel " + asciinum                 exit             end if         next         exit     next end sub 

this should work on activesheet should start getting practice of used defined parent worksheet , use cells values in them instead of looping way down bottom of worksheet.

option explicit  private sub form_load()     dim mystring string, long, asciinum string, f long      worksheets("sheet1")         f = 1 .cells(.rows.count, "i").end(xlup).row             mystring = .cells(f, "i").value2             = 1 len(mystring)                 asciinum = lcase(mid(mystring, i, 1))                 if asciinum = "a" or asciinum = "e" or asciinum = "i" or asciinum = "o" or asciinum = "u"                     .cells(f, "m") = "first vowel " + asciinum                     exit                 end if             next         next f     end end sub 

i've removed second exit for continues outer loop.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -