954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Array a cell

hi there i have a cell [11] which contains "admingroup,update,viewonly" and it is a variable length. So one user can be in different user groups. i'm using an array to split the cell, however i'm only getting the first data (admingroup). here is the code i'm using. thank you in advance

Private Sub CommandButton1_Click()

Dim participant, password, userName, companyName, email, DTime As String
Dim plantList As String
Dim userGroup As String
Dim myString As String
Dim myArray As Variant
Dim irow, icol As Integer
Dim ifh As Long

DTime = CStr(Now())
DTime = Replace(DTime, "/", "-", 1, -1, vbTextCompare)
DTime = Replace(DTime, ":", "-", 1, -1, vbTextCompare)
DTime = Replace(DTime, " ", "-", 1, -1, vbTextCompare)

ifh = FreeFile
FileName = ActiveWorkbook.Path & "\Current_Export Users" & DTime & ".txt"
Open FileName For Output As ifh

irow = 3
With ActiveSheet
On Error Resume Next
While .Cells(irow, 1) <> ""

myString = .Cells(irow, 11)
myArray = Split(myString, ",")

icol = 1
While .Cells(2, icol) <> ""

' Users

userGroup = myArray(0)

participant = .Cells(irow, 1)
password = .Cells(irow, 2)
userName = .Cells(irow, 3)
email = .Cells(irow, 4)

Print #ifh, "----------------------"
Print #ifh, "User Group "
Print #ifh, "----------------------"
Print #ifh, "." & userGroup
Print #ifh, "..UserGroupName|" & userGroup
Print #ifh, "..UserGroupDesc|"
Print #ifh, "----------------------"
Print #ifh, "Export Users"
Print #ifh, "----------------------"
Print #ifh, ""
Print #ifh, ".Usr"
Print #ifh, "..Participant|" & participant
Print #ifh, "..Password|" & password
Print #ifh, "..UserName|" & userName
Print #ifh, "..CompanyName|"
Print #ifh, "..Email|" & email
Print #ifh, "-------- END-----------"

icol = icol + 1
Wend
irow = irow + 1
Wend
End With
Close ifh
End Sub

prav
Newbie Poster
1 post since Nov 2005
Reputation Points: 10
Solved Threads: 0
 

Would It be possible to attach the project as a .zip file, with any needed files?

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You