ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Data Type Problem!!! (https://www.excelbanter.com/excel-programming/361436-data-type-problem.html)

addy

Data Type Problem!!!
 
I am having trouble with a data type ...that is what I suspect.

I am trying to make a macro with a loop for running a Autofilter where in
the macro selects the filtes as 1:01,1:02,1:03....1:40.

I am able to make a loop and run it properly but the problem is that macro
does not work for values 1:01,1:02...1:09 after that it works fine. The
command I am using is:

Dim xsect As Integer
Dim ysect As Integer
..
..(This area has the loop which is working fine)
..
Selection.AutoFilter Field:=6, Criteria1:=xsect & ":" & ysect

Now the problem is the macro runs a search for 1:1 and not 1:01 is there any
way I can make ysect increase by 1 and show i t up as 2 digits for a single
digit as well. If not then what should I do?




Ardus Petus

Data Type Problem!!!
 
Selection.AutoFilter Field:=6, Criteria1:= format(xsect,"00") & ":" &
format(ysect,"00")

If field #6 holds a time value (01:30 = 1 minute 30 secs), that won't work
either.

Cheers,
--
AP

"Addy" a écrit dans le message de news:
...
I am having trouble with a data type ...that is what I suspect.

I am trying to make a macro with a loop for running a Autofilter where in
the macro selects the filtes as 1:01,1:02,1:03....1:40.

I am able to make a loop and run it properly but the problem is that macro
does not work for values 1:01,1:02...1:09 after that it works fine. The
command I am using is:

Dim xsect As Integer
Dim ysect As Integer
.
.(This area has the loop which is working fine)
.
Selection.AutoFilter Field:=6, Criteria1:=xsect & ":" & ysect

Now the problem is the macro runs a search for 1:1 and not 1:01 is there
any
way I can make ysect increase by 1 and show i t up as 2 digits for a
single
digit as well. If not then what should I do?






Ardus Petus

Data Type Problem!!!
 
Ooops: Typo!
Selection.AutoFilter Field:=6, Criteria1:= xsect & ":" & format(ysect,"00")


"Addy" a écrit dans le message de news:
...
I am having trouble with a data type ...that is what I suspect.

I am trying to make a macro with a loop for running a Autofilter where in
the macro selects the filtes as 1:01,1:02,1:03....1:40.

I am able to make a loop and run it properly but the problem is that macro
does not work for values 1:01,1:02...1:09 after that it works fine. The
command I am using is:

Dim xsect As Integer
Dim ysect As Integer
.
.(This area has the loop which is working fine)
.
Selection.AutoFilter Field:=6, Criteria1:=xsect & ":" & ysect

Now the problem is the macro runs a search for 1:1 and not 1:01 is there
any
way I can make ysect increase by 1 and show i t up as 2 digits for a
single
digit as well. If not then what should I do?







All times are GMT +1. The time now is 10:56 PM.

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