Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read Each Cell in Excel File

Status
Not open for further replies.

eyriquezahrul

Technical User
Aug 9, 2012
5
IE
Hi, does anyone know how to loop each cell in a given range in Excel through Attachmate macro? Thank you.
 
hi,

What code do you have so far?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Oh, thanks 4 replying Skip. Never mind. I already have a solution for this. Thank you.
 
It is both customary and proper etiquette to share you solution with other members who may be browsing your thread.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Ok Skip, here is the code for me to browse all the cell and then get the data that I want. I have referred to one of the post in this Attachmate forum to get this solution.

Code:
Sub rExtract()

    Dim rNCell, rNCol, rNRng As Range
    
    Set rNRng = Sheets("RCreation Template").Rows("1:500")
    Set rNCol = Sheets("RCreation Template").Columns("A:HH")
    Sheets.Add.Name = "rName"
    
    For Each rNCol In rNRng.Rows
        For Each rNCell In rNCol.Columns
        
            If rNCell.Value = "Operation" Then
                rNCell.Offset(-2, 0).Copy
                
                Sheets("rName").Select
                If IsEmpty(ActiveCell) Then
                    Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                        :=False, Transpose:=False
                Else
                    Range("A65536").End(xlUp).Offset(1, 0).Select
                    ActiveCell.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                        :=False, Transpose:=False
                End If
            End If
        Next rNCell
    Next rNCol
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top