help with dataform and sorting macros
I created a dataform macro in Excel with the Auto_Open
name. I need the dataform to be for just the headings in columns A-G, although there are column headings in A-P, H- P aren't needed for the average data entry person. Does anyone have any suggestions? I also need to have a column G sort ascending upon close, Auto_Close macro. I got it started, but since Row 1 is a merged cell, and isn't included in the macro, I keep getting a debugging error. Need to sort G2--end of data. Any suggestions? I can provide copies of the macro wording that I tried to use if you need to see it. Thanks! Beth |
help with dataform and sorting macros
When working on the dataform macro, I get an error -
debugging message - when I run this at the line: Set myRng = Worksheets("sheet1").Range("a:g") Any suggestions? Thanks, Beth -----Original Message----- If you name your range, excel will look there to find your database: Option Explicit Sub testme() Dim myRng As Range Set myRng = Worksheets("sheet1").Range("a:g") myRng.Name = "database" Worksheets("sheet1").ShowDataForm End Sub In your auto_close, maybe you could sort your data with headers:=xlno. (just start with the real data--row 2???). with worksheets("sheet1") .range("a2:g" & .cells(.rows.count,"A").end (xlup).row).sort ..... end with I used the last cell in column A to find the end of data. And I only sorted through G. Fix both of those to match your data.) Beth Mc wrote: I created a dataform macro in Excel with the Auto_Open name. I need the dataform to be for just the headings in columns A-G, although there are column headings in A-P, H- P aren't needed for the average data entry person. Does anyone have any suggestions? I also need to have a column G sort ascending upon close, Auto_Close macro. I got it started, but since Row 1 is a merged cell, and isn't included in the macro, I keep getting a debugging error. Need to sort G2--end of data. Any suggestions? I can provide copies of the macro wording that I tried to use if you need to see it. Thanks! Beth -- Dave Peterson . |
help with dataform and sorting macros
Okay, I'm confused on the sorting macro wording that you
listed. What is headers-xlno? I'm fairly new to macros, so spelling it out like you did for the dataform really helps me. My sort at auto_close is now sorting the data, but it is moving the header row of A2:G2 below the data when it sorts. So instead of A2:G2 showing the column headers, the column headers are moved to A11:G11 and the data is sorted (correctly) in A2:G10. The column headers for H2:P2 stay in the same place. Thanks for the help! Beth -----Original Message----- If you name your range, excel will look there to find your database: Option Explicit Sub testme() Dim myRng As Range Set myRng = Worksheets("sheet1").Range("a:g") myRng.Name = "database" Worksheets("sheet1").ShowDataForm End Sub In your auto_close, maybe you could sort your data with headers:=xlno. (just start with the real data--row 2???). with worksheets("sheet1") .range("a2:g" & .cells(.rows.count,"A").end (xlup).row).sort ..... end with I used the last cell in column A to find the end of data. And I only sorted through G. Fix both of those to match your data.) Beth Mc wrote: I created a dataform macro in Excel with the Auto_Open name. I need the dataform to be for just the headings in columns A-G, although there are column headings in A-P, H- P aren't needed for the average data entry person. Does anyone have any suggestions? I also need to have a column G sort ascending upon close, Auto_Close macro. I got it started, but since Row 1 is a merged cell, and isn't included in the macro, I keep getting a debugging error. Need to sort G2--end of data. Any suggestions? I can provide copies of the macro wording that I tried to use if you need to see it. Thanks! Beth -- Dave Peterson . |
All times are GMT +1. The time now is 10:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com