应用程序定义或对象定义错误 [英] Application defind or object defind error

查看:1034
本文介绍了应用程序定义或对象定义错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过互联网上的可用视频学习VBA宏。当我尝试执行程序时,这个特定语句抛出错误 - 范围(A2)。结束(xlDown).Offset(1, 0).Value = Film_Name。但是在视频中正确执行。请帮助我解决问题



子通用()

Dim Film_Name As String

Dim Film_Date As Date

Dim Film_length As Integer



Film_Name = InputBox(Enter电影名称)

Film_Date = InputBox(输入日期)

Film_length =输入框(请输入电影的长度)

范围(A2)。结束(xlDown)。偏移(1,0).Value = Film_Name

范围(A2)。结束(xlDown)。偏移(0,1 ).Value = Film_Date

范围(A2)。结束(xlDown)。偏移(0,2).Value = Film_length



结束分



我尝试过:



我没有判断语句有什么问题。语法与视频中显示的相同。

I am learning VBA macros from the available videos over internet.When i am trying to execute the program,this particular statement is throwing the error -- "Range("A2").End(xlDown).Offset(1, 0).Value = Film_Name".But in the video is executed properly.Please help me with the issue

Sub generic()
Dim Film_Name As String
Dim Film_Date As Date
Dim Film_length As Integer

Film_Name = InputBox("Enter a film name")
Film_Date = InputBox("Enter a Date")
Film_length=Inputbox("Please enter the length of the film")
Range("A2").End(xlDown).Offset(1, 0).Value = Film_Name
Range("A2").End(xlDown).Offset(0, 1).Value = Film_Date
Range("A2").End(xlDown).Offset(0, 2).Value = Film_length

End Sub

What I have tried:

I have no clue what is wrong with the statement.Syntax is same as showed in the video.

推荐答案

你需要在第一列中有一些数据,这样当它向下看A2以外的第一个空闲单元时,它会找到一些东西。只需在单元格A1,A2,A3,A4中添加一些随机单词即可。它可以正常工作。
You need some data in the first column so that when it looks down for the first free cell beyond A2 it will find something. Just add a few random words to cells A1, A2, A3, A4, and it should work.


这篇关于应用程序定义或对象定义错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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