VBA代码超出范围错误,查找以下内容的最后一个空行 [英] Out o range error vba code finding last empty row for

查看:139
本文介绍了VBA代码超出范围错误,查找以下内容的最后一个空行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在irowtro上出现错误

错误超出范围
请帮助我

its giving error on irowtro

error is out of range
please help me

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


谢谢
akshay


thanks
akshay

推荐答案

irowtro的声明从Integer更改为Long.

有关VBA中数据类型的更多信息: http://office.blogs.webucator. com/2010/11/30/data-types-in-vba/ [ 版本 说明 Excel 97- 2k3 65,536行乘256列 Excel 2k7及更高版本 1,048,576行乘16,384列 表格>
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


这篇关于VBA代码超出范围错误,查找以下内容的最后一个空行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆