Convert If InStr Excel VBA to Access Expression?

rhaas128

Board Regular
Joined
Jul 5, 2013
Messages
84
I have the below code in Excel VBA. I was wanting to try and put this into Access as an expression perhaps? The goal is to look at each record in the table and parse out the Access Profile Name. Anyone able to help me out?

Code:
Dim R As Long, Data As Variant
  Data = Range("G2", Cells(Rows.Count, "G").End(xlUp))
  For R = 1 To UBound(Data)
    If InStr(Data(R, 1), "Access Profile Name : ") Then
      Data(R, 1) = Split(Split(Data(R, 1), "Access Profile Name : ", , vbTextCompare)(1), vbLf)(0)
    Else
      Data(R, 1) = "AP Name Unknown"
    End If
  Next
  Range("J2").Resize(UBound(<wbr>Data)) = Data
 
Last edited:
This worked perfectly. It wasn't too much different and I understand all of the logic and code you have. Thanks for your help! Really appreciate it. :)
 
Upvote 0

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,215,264
Messages
6,123,960
Members
449,135
Latest member
jcschafer209

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