Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userforms and autofilters - Autofilters don't seen to work with userform
I would like to have my userform display only what rows are filtered at a
given time. I would like to be able to use autofilter from normal excel screen, and then use my userform. I would also like to be able to record one of the autofilters and assign it to a button on my userform. Currently, when I step through the rows with the up/down buttons on my form, it shows each and every row. Right now, I have 2 fields being displayed First and lastname, and then my up/down SpinButton (and some other buttons for printing, closing ans saving....) What am I doing wrong? I have the following code: --------------------------------------- 'module1 Sub GetGoing_CI() If ActiveCell.Row = 1 Then ActiveCell.Offset(1, 0).Select Dim jump As Variant jump = 1 - ActiveCell.Column ActiveCell.Offset(0, jump).Select ActiveSheet.Range("A1").Select 'so that current region in init works UserForm1.Show End Sub Sub FillMyForm1() ContactFilterFlag = False With UserForm1 'Assignment Col Ofs Item ' .textbox0 =ActiveCell.Offset(0, 0) ' A 0 Record_Number ..TextBox1 = ActiveCell.Offset(0, 1) ' B 1 First ..TextBox2 = ActiveCell.Offset(0, 2) ' C 2 LastName End With End Sub --------------------------------------------- 'Userform1 Private Sub UserForm_Initialize() Worksheets("Contacts").Select ws = "Contacts" FillMyForm1 End Sub Private Sub CommandButton1_Click() Dim Mldg, stil, Titel, Antwort Mldg = "Don't you want to save the database now ?" stil = vbYesNo + vbCritical + vbDefaultButton2 Titel = "Exit Form" Antwort = MsgBox(Mldg, stil, Titel) If Antwort = vbYes Then ActiveWorkbook.Save Else End If Unload UserForm1 End Sub Private Sub CommandButton2_Click() UserForm1.PrintForm End Sub Private Sub CommandButton3_Click() ActiveWorkbook.Save End Sub Private Sub SpinButton1_SpinDown() ActiveCell.Offset(1, 0).Select FillMyForm1 End Sub Private Sub SpinButton1_SpinUp() ActiveCell.Offset(-1, 0).Select FillMyForm1 End Sub Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userforms and autofilters - Autofilters don't seen to work with userform
It doesn't make any difference to Vba if your cells are hidden. You have to
check the cells to see if they are hidden and have your code ignore those cells. -- Regards, Tom Ogilvy wrote in message news:MNo3b.284371$Ho3.39036@sccrnsc03... I would like to have my userform display only what rows are filtered at a given time. I would like to be able to use autofilter from normal excel screen, and then use my userform. I would also like to be able to record one of the autofilters and assign it to a button on my userform. Currently, when I step through the rows with the up/down buttons on my form, it shows each and every row. Right now, I have 2 fields being displayed First and lastname, and then my up/down SpinButton (and some other buttons for printing, closing ans saving....) What am I doing wrong? I have the following code: --------------------------------------- 'module1 Sub GetGoing_CI() If ActiveCell.Row = 1 Then ActiveCell.Offset(1, 0).Select Dim jump As Variant jump = 1 - ActiveCell.Column ActiveCell.Offset(0, jump).Select ActiveSheet.Range("A1").Select 'so that current region in init works UserForm1.Show End Sub Sub FillMyForm1() ContactFilterFlag = False With UserForm1 'Assignment Col Ofs Item ' .textbox0 =ActiveCell.Offset(0, 0) ' A 0 Record_Number .TextBox1 = ActiveCell.Offset(0, 1) ' B 1 First .TextBox2 = ActiveCell.Offset(0, 2) ' C 2 LastName End With End Sub --------------------------------------------- 'Userform1 Private Sub UserForm_Initialize() Worksheets("Contacts").Select ws = "Contacts" FillMyForm1 End Sub Private Sub CommandButton1_Click() Dim Mldg, stil, Titel, Antwort Mldg = "Don't you want to save the database now ?" stil = vbYesNo + vbCritical + vbDefaultButton2 Titel = "Exit Form" Antwort = MsgBox(Mldg, stil, Titel) If Antwort = vbYes Then ActiveWorkbook.Save Else End If Unload UserForm1 End Sub Private Sub CommandButton2_Click() UserForm1.PrintForm End Sub Private Sub CommandButton3_Click() ActiveWorkbook.Save End Sub Private Sub SpinButton1_SpinDown() ActiveCell.Offset(1, 0).Select FillMyForm1 End Sub Private Sub SpinButton1_SpinUp() ActiveCell.Offset(-1, 0).Select FillMyForm1 End Sub Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userforms and autofilters - Autofilters don't seen to work with userform
so basically when I do my spindown it should be something like this:
Private Sub SpinButton1_SpinDown() ActiveCell.Offset(1, 0).Select do While Selection.rows.Hidden = True ActiveCell.Offset(1, 0).Select Loop FillMyForm1 End Sub "Tom Ogilvy" wrote in message ... It doesn't make any difference to Vba if your cells are hidden. You have to check the cells to see if they are hidden and have your code ignore those cells. -- Regards, Tom Ogilvy wrote in message news:MNo3b.284371$Ho3.39036@sccrnsc03... I would like to have my userform display only what rows are filtered at a given time. I would like to be able to use autofilter from normal excel screen, and then use my userform. I would also like to be able to record one of the autofilters and assign it to a button on my userform. Currently, when I step through the rows with the up/down buttons on my form, it shows each and every row. Right now, I have 2 fields being displayed First and lastname, and then my up/down SpinButton (and some other buttons for printing, closing ans saving....) What am I doing wrong? I have the following code: --------------------------------------- 'module1 Sub GetGoing_CI() If ActiveCell.Row = 1 Then ActiveCell.Offset(1, 0).Select Dim jump As Variant jump = 1 - ActiveCell.Column ActiveCell.Offset(0, jump).Select ActiveSheet.Range("A1").Select 'so that current region in init works UserForm1.Show End Sub Sub FillMyForm1() ContactFilterFlag = False With UserForm1 'Assignment Col Ofs Item ' .textbox0 =ActiveCell.Offset(0, 0) ' A 0 Record_Number .TextBox1 = ActiveCell.Offset(0, 1) ' B 1 First .TextBox2 = ActiveCell.Offset(0, 2) ' C 2 LastName End With End Sub --------------------------------------------- 'Userform1 Private Sub UserForm_Initialize() Worksheets("Contacts").Select ws = "Contacts" FillMyForm1 End Sub Private Sub CommandButton1_Click() Dim Mldg, stil, Titel, Antwort Mldg = "Don't you want to save the database now ?" stil = vbYesNo + vbCritical + vbDefaultButton2 Titel = "Exit Form" Antwort = MsgBox(Mldg, stil, Titel) If Antwort = vbYes Then ActiveWorkbook.Save Else End If Unload UserForm1 End Sub Private Sub CommandButton2_Click() UserForm1.PrintForm End Sub Private Sub CommandButton3_Click() ActiveWorkbook.Save End Sub Private Sub SpinButton1_SpinDown() ActiveCell.Offset(1, 0).Select FillMyForm1 End Sub Private Sub SpinButton1_SpinUp() ActiveCell.Offset(-1, 0).Select FillMyForm1 End Sub Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userforms and autofilters - Autofilters don't seen to work with userform
That should work.
-- Regards, Tom Ogilvy wrote in message news:CWp3b.284931$Ho3.39214@sccrnsc03... so basically when I do my spindown it should be something like this: Private Sub SpinButton1_SpinDown() ActiveCell.Offset(1, 0).Select do While Selection.rows.Hidden = True ActiveCell.Offset(1, 0).Select Loop FillMyForm1 End Sub "Tom Ogilvy" wrote in message ... It doesn't make any difference to Vba if your cells are hidden. You have to check the cells to see if they are hidden and have your code ignore those cells. -- Regards, Tom Ogilvy wrote in message news:MNo3b.284371$Ho3.39036@sccrnsc03... I would like to have my userform display only what rows are filtered at a given time. I would like to be able to use autofilter from normal excel screen, and then use my userform. I would also like to be able to record one of the autofilters and assign it to a button on my userform. Currently, when I step through the rows with the up/down buttons on my form, it shows each and every row. Right now, I have 2 fields being displayed First and lastname, and then my up/down SpinButton (and some other buttons for printing, closing ans saving....) What am I doing wrong? I have the following code: --------------------------------------- 'module1 Sub GetGoing_CI() If ActiveCell.Row = 1 Then ActiveCell.Offset(1, 0).Select Dim jump As Variant jump = 1 - ActiveCell.Column ActiveCell.Offset(0, jump).Select ActiveSheet.Range("A1").Select 'so that current region in init works UserForm1.Show End Sub Sub FillMyForm1() ContactFilterFlag = False With UserForm1 'Assignment Col Ofs Item ' .textbox0 =ActiveCell.Offset(0, 0) ' A 0 Record_Number .TextBox1 = ActiveCell.Offset(0, 1) ' B 1 First .TextBox2 = ActiveCell.Offset(0, 2) ' C 2 LastName End With End Sub --------------------------------------------- 'Userform1 Private Sub UserForm_Initialize() Worksheets("Contacts").Select ws = "Contacts" FillMyForm1 End Sub Private Sub CommandButton1_Click() Dim Mldg, stil, Titel, Antwort Mldg = "Don't you want to save the database now ?" stil = vbYesNo + vbCritical + vbDefaultButton2 Titel = "Exit Form" Antwort = MsgBox(Mldg, stil, Titel) If Antwort = vbYes Then ActiveWorkbook.Save Else End If Unload UserForm1 End Sub Private Sub CommandButton2_Click() UserForm1.PrintForm End Sub Private Sub CommandButton3_Click() ActiveWorkbook.Save End Sub Private Sub SpinButton1_SpinDown() ActiveCell.Offset(1, 0).Select FillMyForm1 End Sub Private Sub SpinButton1_SpinUp() ActiveCell.Offset(-1, 0).Select FillMyForm1 End Sub Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
AutoFilters | Excel Worksheet Functions | |||
Freezing Autofilters | Excel Worksheet Functions | |||
How to set up AutoFilters? | Excel Worksheet Functions | |||
autofilters | Excel Worksheet Functions | |||
Help with Userforms and filters or autofilters | Excel Programming |