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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What's wrong? 2

Status
Not open for further replies.

newguy86

Technical User
May 19, 2008
226
US
I am writing a macro through IBM Reflection VBA that utilizes an Excel file to provide the information it needs. And what I am trying to do is from the Reflection Session the macro gets information from an Excel file and inputs it into Reflection and proceeds to perform its various functions. The problem that I am having is that when the macro is done I want it to move to the next cell down and start all over again. In other words I want the macro to move down a list, who's range varies depending on the amount of information. So, what am I doing wrong? I keep trying to do this and have probably come close to the correct answer but everytime try to do this it never works. Either it completly doesn't do what I wanted it to do or I get a varying amount of error messages. I have provided the macro for you to see and make changes to. Also keep in mind that I am fairly new to VBA and some of the jargon is a little foriegn to me. Thanks!

Dim CellContents As String
Dim LocationCount As Integer
Set ExcelApp = Excel.Application
Set ExcelWorkbook = ExcelApp.Workbooks.Open("R:\My Documents\Location Codes To Delete Rates.xls")
LocationCount = 2
StartPos = ExcelApp.ActiveSheets(Sheet1).Range("A & LocationCount")
With Session
If Range("A & LocationCount") <> "" Then
Do While CellContents <> ""
.RunMacro "NewMacros.Location_Code_Input", ""
Let LocationCount = LocationCount + 1
Loop
End If
End With
 
I just wanted to say thank you to all who helped out. I am proud to say that we now have a fully functional macro that is running fast, straight, and frequent. So again thank you to all who helped.
 





Another small improvement. This statement structure is redundant, because it is in the loop criteria...
Code:
If StartPos <> "" Then



End if

Skip,

[glasses]Just traded in my old subtlety...
for a brand NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top