From: Simon on 22 Apr 2010 04:45 Hi there, I hope you can help, I am not VB literate unfortunately but I am trying to run a macro with the following line of code which creates an error: LastRow = Master_Wksht.Range("N" & Rows.Count).End(xlup).Row Is there a change between versions which means this line won't work any more?
From: Mike H on 22 Apr 2010 05:09 Simon, That line is fine in E2007 provided you have 'SET' Master_Wksht but if you hadn't done that it wouldn't have run in earlier versions of Excel Set Master_Wksht = Sheets("Sheet1") What have you dimmed LastRow as it should be long. -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Simon" wrote: > Hi there, I hope you can help, I am not VB literate unfortunately but I am > trying to run a macro with the following line of code which creates an error: > > LastRow = Master_Wksht.Range("N" & Rows.Count).End(xlup).Row > > Is there a change between versions which means this line won't work any more? > > >
From: Mike H on 22 Apr 2010 05:14 Hmm, I forgot the obvious question. What is the error message? -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Simon" wrote: > Hi there, I hope you can help, I am not VB literate unfortunately but I am > trying to run a macro with the following line of code which creates an error: > > LastRow = Master_Wksht.Range("N" & Rows.Count).End(xlup).Row > > Is there a change between versions which means this line won't work any more? > > >
From: Kevryl on 22 Apr 2010 05:25 Hi Simon, you've got me, being new to 2007 too. No doubt someone will soon give you a definitive answer soon, but until then... I had a problem running a macro that tripped on the line, "Windows("Accounting.xls").Activate" which was merely to switch between 2 windows in the one instance of Excel. It tripped the first time giving an error message, so I went into debugging, stepping over all the commands up to that one and then "stepped into" from there. It found its way through without an issue and then worked perfectly after that. So its possible that if you do the same, yours too may "settle in" (OK, some Excel geek can ridicule the terminology, but it worked ;-). ) Remember that any commands before the one that tripped will have been executed, so you may not want them to execute again! Turn on the "debug" toolbar and use the "step over" and "step into" buttons. Be aware that the "Continue" button (right-pointing triangle) will run from the point you're at right to the end. "Simon" wrote: > Hi there, I hope you can help, I am not VB literate unfortunately but I am > trying to run a macro with the following line of code which creates an error: > > LastRow = Master_Wksht.Range("N" & Rows.Count).End(xlup).Row > > Is there a change between versions which means this line won't work any more? > > >
From: Mike H on 22 Apr 2010 05:43 Kevryl, I think it highly unlikely a macro would 'settle in' and learn to live with an error. You note you were working in 2007 and called another workbook using Windows("Accounting.xls").Activate If it was a 2007 workbook then that line will fail because of an incorrect file extension which should be Windows("Accounting.xlsx").Activate or another appropriate extension for the type of 2007 workbook -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Kevryl" wrote: > Hi Simon, you've got me, being new to 2007 too. No doubt someone will soon > give you a definitive answer soon, but until then... > > I had a problem running a macro that tripped on the line, > "Windows("Accounting.xls").Activate" which was merely to switch between 2 > windows in the one instance of Excel. It tripped the first time giving an > error message, so I went into debugging, stepping over all the commands up to > that one and then "stepped into" from there. It found its way through without > an issue and then worked perfectly after that. So its possible that if you do > the same, yours too may "settle in" (OK, some Excel geek can ridicule the > terminology, but it worked ;-). ) > > Remember that any commands before the one that tripped will have been > executed, so you may not want them to execute again! Turn on the "debug" > toolbar and use the "step over" and "step into" buttons. Be aware that the > "Continue" button (right-pointing triangle) will run from the point you're at > right to the end. > > "Simon" wrote: > > > Hi there, I hope you can help, I am not VB literate unfortunately but I am > > trying to run a macro with the following line of code which creates an error: > > > > LastRow = Master_Wksht.Range("N" & Rows.Count).End(xlup).Row > > > > Is there a change between versions which means this line won't work any more? > > > > > >
|
Next
|
Last
Pages: 1 2 Prev: Replacing carriage returns with a comma Next: request for a solution on shared documents |