eciabattari
asked on
Excel search Range
Hi - I have the following code that will open an Excel spreadsheet and return the values in Column A. Let’s say that cell A1 is "boc ctgg-documentum", I want the program to then read a select range (C1:C3) and return the data in each cell. Here’s the code that I have so far. Any ideas? Thanks for the help.
'------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------
Public Function CheckGroupInformation()
On Error Resume Next
Dim xl As New Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
Set wb = xl.Workbooks.Open(txtPath. Text)
Set wb = xl.Workbooks.Open(strGroup Drive)
Set ws = wb.Worksheets("Group")
'counts the number of rows within the workbook
wb.Application.ActiveCell. SpecialCel ls(xlCellT ypeLastCel l).Select
strCells = wb.Application.ActiveCell. Row
'loop that gets name & then creates folders
For r = 1 To strCells
x = ws.Cells(r, 1)
strGroupName = x
Call CheckUserName
For Each x In strCells
If x = "boc ctgg-documentum" Then
For Each y In strCells
y = ws.Range("C1")
Debug.Print y
Next y
End If
Call MembersOfGroup(strGroupNam e, "mycompany.net", strUserName)
If strGroupMembers = "1" Then
ws.Cells(r, 2).Value = "Is a member"
ws.Cells(r, 2).Font.Bold = True
ws.Cells(r, 2).Font.Color = vbBlue
End If
Next x
Next r
'cleanup
wb.Application.Workbooks(1 ).Save
wb.Close
xl.Quit
cmdMoveFiles.Visible = False
cmdDone.Visible = True
Set wb = Nothing
Set xl = Nothing
End Function
'------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------
'-------------------------
Public Function CheckGroupInformation()
On Error Resume Next
Dim xl As New Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
Set wb = xl.Workbooks.Open(txtPath.
Set wb = xl.Workbooks.Open(strGroup
Set ws = wb.Worksheets("Group")
'counts the number of rows within the workbook
wb.Application.ActiveCell.
strCells = wb.Application.ActiveCell.
'loop that gets name & then creates folders
For r = 1 To strCells
x = ws.Cells(r, 1)
strGroupName = x
Call CheckUserName
For Each x In strCells
If x = "boc ctgg-documentum" Then
For Each y In strCells
y = ws.Range("C1")
Debug.Print y
Next y
End If
Call MembersOfGroup(strGroupNam
If strGroupMembers = "1" Then
ws.Cells(r, 2).Value = "Is a member"
ws.Cells(r, 2).Font.Bold = True
ws.Cells(r, 2).Font.Color = vbBlue
End If
Next x
Next r
'cleanup
wb.Application.Workbooks(1
wb.Close
xl.Quit
cmdMoveFiles.Visible = False
cmdDone.Visible = True
Set wb = Nothing
Set xl = Nothing
End Function
'-------------------------
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.