View Full Version : Solved: move cursor to row X in active column
danovkos
05-06-2009, 05:22 AM
hi all,
is possible to change this code to other, which will look on the concrete row which i defined after inserting rows?
Cells("3000", ActiveCell.Column).Select
to something like this, but this doesnt works :(
Cells(Row(ActiveCell.Column & 3000), ActiveCell.Column).Select
the existing code is assigned to button. After clicking on the button it moves cursor on active sheet to concrete row (place, where start next month for me). Problem is, that sometimes i insert a row and, then this code move me to fixed cell, which is not a start of month. I want to change code that, it will always on the start of month.
F.e.
After clicking on "button 1" move cursor on row 3000.
Month january starts on row 3000. After inserting 10 rows, the month starts at 3010. I want the code, which will move me then on row 3010 in active column.
How can i do this?
thx
mdmackillop
05-06-2009, 05:37 AM
Add a Find to your button, something like this
Sub DateCol()
Dim c As Range, Dte As Date
Dte = CDate("1/6/09")
Set c = Columns(1).Find(Dte)
Cells(c.Row, ActiveCell.Column).Select
End Sub
danovkos
05-06-2009, 05:43 AM
fuuhh :)
you are flash
yes, it works great, thank you very much :)
danovkos
05-11-2009, 06:51 AM
hi all,
i have little problem. This code worked for me, till today. Now it is stops works and return error
error 91 "object variable or with block variable not set"
and it stops on row
Cells(c.Row, ActiveCell.Column).Select
what is wrong?
i think i did nothing. The code is the same, my table is the same - only i updated my data. And now it doesnt works:(
danovkos
05-11-2009, 07:26 AM
i restart my workbook without saving personal.xls and it works again :)
so thx, now its OK
mdmackillop
05-11-2009, 07:58 AM
This will avoid error message if no date found
Sub DateCol()
Dim c As Range, Dte As Date
Dte = CDate("1/6/09")
Set c = Columns(1).Find(Dte)
If Not c Is Nothing Then
Cells(c.Row, ActiveCell.Column).Select
Else
MsgBox Dte & " not found"
End If
End Sub
danovkos
05-12-2009, 05:31 AM
thx for error trap, but i have still the problem.
Now it doesnt return error, but message, "is not found".
But question is, why it didn find it? i changed nothing :(
Yesterday it works and now doesnt again :(.
I am confused.
Date still are in column.
what is wrong please?
i have to something define?
mdmackillop
05-12-2009, 05:32 AM
Can you post your workbook?
danovkos
05-12-2009, 05:42 AM
it is a big table with 5000 rows and 90 columns (some hidden), with a few button. I can create a similiar wb, but it will not the same, because my wb contains secred data :(
mdmackillop
05-12-2009, 05:45 AM
We just need the date column and how you supply the date to check the error
danovkos
05-12-2009, 05:49 AM
what should i looking for
if i good understund this code
it define C and dte
then give to dte exact date (what i search)
and then i looks in column and searching this date
then return on concrete row in active column
the date is in my column 1 still the same, is there written „1.1.2009“ with format „mmmm“
Of course if i looking for date 1/1/09
ok i will try post it..
danovkos
05-12-2009, 05:58 AM
here is my wb. Green button move my cursor on date.
1 - january, 2- feb....
In real wb i have more sheets. And when i created buttons for similiar data in other sheet i use copy paste this button - and now i have the same name for buttons in this sheet but also for other sheet - can by this the problem?
mdmackillop
05-12-2009, 06:41 AM
There are no dates in your workbook. :dunno
danovkos
05-12-2009, 06:47 AM
yes, there are
in cells
b3883
b4106
...
danovkos
05-18-2009, 01:09 AM
did you find the dates?
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.