Click here to Skip to main content
15,885,823 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
its giving error on irowtro

error is out of range
please help me

VB
Sub transferorderdata()
Dim wkbor, wkbvl, wkbysd, wkbtr As Workbook
Dim wknm, wknm1, wknm2  As String

wknm2 = "C:\vbproject\tracker\ysdflow2.xlsx"
wknm = "d:\a.xlsx" '-------Open order
wknm1 = "d:\SAMPLE.xlsx" '------tracker file
Set wkbor = Workbooks.Open(wknm)
Set wkbtr = Workbooks.Open(wknm1)
Dim irowor, irowtro, irowtrs As Integer
Dim i, j As Integer
Dim selor, seltro As String
Dim blnor As Boolean
Dim sample As String

'__________________Ordering Compare_________________
irowor = wkbor.Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
irowtro = wkbtr.Sheets("Ordering").Cells(Rows.Count, 2).End(xlUp).Offset(1, 0).Row

thanks
akshay
Posted

1 solution

Change the declaration of irowtro from Integer to Long.

More about data types in VBA: http://office.blogs.webucator.com/2010/11/30/data-types-in-vba/[^]

MS Excel specifications:

VersionDescription
Excel 97- 2k365,536 rows by 256 columns
Excel 2k7 and higher1,048,576 rows by 16,384 columns
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900