ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Anyone know what's happening with this bit of basic? (https://www.excelbanter.com/excel-programming/376876-anyone-know-whats-happening-bit-basic.html)

kirkm[_6_]

Anyone know what's happening with this bit of basic?
 

---
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)

Dim rng As Range
Dim MyLastRow As String
Dim MyLastCol As Integer


Set rng =
Worksheets("mySheet").Range("A1").SpecialCells(xlC ellTypeLastCell)
MyLastRow = rng.Row
MyLastCol = rng.Column



Rows = "G1:G" & MyLastRow

If Not Intersect(Target, Range(Rows)) Is Nothing Then

Stop
End If

End Sub
---

What is supposed to happen (and sometimes does) is, if you
double click a cell in column G, it should stop at the Stop statement.

Otherwise it should do nothing.

But sometimes (and right know every time) it overwrites all the cells
with
"G1:Gxxx "and trashes around with the hard drive for ages. Eventually
I hit the reset buttion in disgust, and I can load the xls backin,
with all back to normal, until I click col G again.

I also can't step through it or figure what the probelm is.

Thanks - Kirk

kirkm[_6_]

Anyone know what's happening with this bit of basic?
 
I figured it out.

'rows' needs to be dimmed. Must be a system name or command.

Chip Pearson

Anyone know what's happening with this bit of basic?
 
Rows is the name of a VBA Property. Do NOT use it as a variable name. Choose
something else.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com
(email address is on the web site)

"kirkm" wrote in message
...
I figured it out.

'rows' needs to be dimmed. Must be a system name or command.





All times are GMT +1. The time now is 08:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com