ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell Reference (https://www.excelbanter.com/excel-programming/312018-cell-reference.html)

NEW LEARNER

Cell Reference
 
how to ensure cell reference created in macro is working correctly under
excel worksheet?

If Col <= 7 Then Range("X1").Select

when the arguement is less than 7, it should go to worksheet cell X1, but
end up in cell Y2. why?

Tom Ogilvy

Cell Reference
 
if you open a brand new workbook and put in code like

Sub Tester1()
dim col as Long
col = 5
if col <= 7 then Range("X1").Select
End sub

then run it, you should end up in cell X1. If that isn't happening in your
current environment, then it is something besides that line of code
contributing to the problem.

--
Regards,
Tom Ogilvy

"New Learner" <New wrote in message
...
how to ensure cell reference created in macro is working correctly under
excel worksheet?

If Col <= 7 Then Range("X1").Select

when the arguement is less than 7, it should go to worksheet cell X1, but
end up in cell Y2. why?




Steve Smallman

Cell Reference
 
Ok, how are you defining the variable "Col"

Steve
"New Learner" <New wrote in message
...
how to ensure cell reference created in macro is working correctly under
excel worksheet?

If Col <= 7 Then Range("X1").Select

when the arguement is less than 7, it should go to worksheet cell X1, but
end up in cell Y2. why?





All times are GMT +1. The time now is 07:27 AM.

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