Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
So easy you will probably laugh
Hello,
I want this to run this when i hit a button <add in my form. It works great if the correct worksheet is open, but I don't run the form in this sheet so again how do I tell it to look on the database worksheet? 'checks how many rows have data in l and copies the formula down in m Range("m2", Range("l2").End(xlDown)).Offset(1, 1).FillDown Thanks guys-- Though daily learning, I LOVE EXCEL! Jennifer |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
So easy you will probably laugh
"Jennifer" wrote in message
... Hello, I want this to run this when i hit a button <add in my form. It works great if the correct worksheet is open, but I don't run the form in this sheet so again how do I tell it to look on the database worksheet? 'checks how many rows have data in l and copies the formula down in m Range("m2", Range("l2").End(xlDown)).Offset(1, 1).FillDown Thanks guys-- Though daily learning, I LOVE EXCEL! Jennifer Hi Jennifer, Try: With Worksheets("YourDatabaseSheetName") .Range("m2", .Range("l2").End(xlDown)).Offset(1, 1).FillDown End With Note the prepending dot before each instance of Range. If you do not qualify the range addresses, the reference will always be to the currently active sheet. --- Regards, Norman |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
So easy you will probably laugh
Sheets("database").Select
-- Gary "Jennifer" wrote in message ... Hello, I want this to run this when i hit a button <add in my form. It works great if the correct worksheet is open, but I don't run the form in this sheet so again how do I tell it to look on the database worksheet? 'checks how many rows have data in l and copies the formula down in m Range("m2", Range("l2").End(xlDown)).Offset(1, 1).FillDown Thanks guys-- Though daily learning, I LOVE EXCEL! Jennifer |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
So easy you will probably laugh
Prequalify the range with a worksheet reference
Worksheets("Database").Range.......... etc. -- Cheers Nigel "Gary Keramidas" wrote in message ... Sheets("database").Select -- Gary "Jennifer" wrote in message ... Hello, I want this to run this when i hit a button <add in my form. It works great if the correct worksheet is open, but I don't run the form in this sheet so again how do I tell it to look on the database worksheet? 'checks how many rows have data in l and copies the formula down in m Range("m2", Range("l2").End(xlDown)).Offset(1, 1).FillDown Thanks guys-- Though daily learning, I LOVE EXCEL! Jennifer |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
So easy you will probably laugh
No laughing here - we all had to learn. I can see from all your posts that
you are working hard on learning Excel/VBA, so keep it up! And as a general answer in addition to the other posts: when working with multiple worksheets, workbooks, etc. I try to always reference everything to the "highest level" object necessary. That is, if working strictly within one workbook but with multiple sheets, I will always use Worksheets("SheetName").Range(Address)...; if I am working simultaneously with many workbooks I will specify Workbooks("BookName").Worksheets("SheetName").Rang e(Address)... and so on. Better yet, if I am going to use these repeatedly, is to use the With... End With structure or else assign the worksheet to a variable: Dim MySheet as Worksheet Set MySheet=Workbooks("BookName").Worksheets("SheetNam e") It helps avoid confusion both as I oringially code it and - more importantly - when sometime down the road I (or someone else) needs to debug or modify it! Long answer to a short question - but I am a teacher at heart (and, at times, by vocation)! "Jennifer" wrote: Hello, I want this to run this when i hit a button <add in my form. It works great if the correct worksheet is open, but I don't run the form in this sheet so again how do I tell it to look on the database worksheet? 'checks how many rows have data in l and copies the formula down in m Range("m2", Range("l2").End(xlDown)).Offset(1, 1).FillDown Thanks guys-- Though daily learning, I LOVE EXCEL! Jennifer |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
So easy you will probably laugh
Sorry, i didn't read your reply's until today. Sometimes I need a few days to
detox. K'Dales thank you so much for the extended answer, I to am a teacher at heart and sometimes as a vocation so I really enjoy it when someone takes the time to really explain the answer. Thank you so much. I will work hard to understand your reply. Regards, Jennifer -- Though daily learning, I LOVE EXCEL! Jennifer "K Dales" wrote: No laughing here - we all had to learn. I can see from all your posts that you are working hard on learning Excel/VBA, so keep it up! And as a general answer in addition to the other posts: when working with multiple worksheets, workbooks, etc. I try to always reference everything to the "highest level" object necessary. That is, if working strictly within one workbook but with multiple sheets, I will always use Worksheets("SheetName").Range(Address)...; if I am working simultaneously with many workbooks I will specify Workbooks("BookName").Worksheets("SheetName").Rang e(Address)... and so on. Better yet, if I am going to use these repeatedly, is to use the With... End With structure or else assign the worksheet to a variable: Dim MySheet as Worksheet Set MySheet=Workbooks("BookName").Worksheets("SheetNam e") It helps avoid confusion both as I oringially code it and - more importantly - when sometime down the road I (or someone else) needs to debug or modify it! Long answer to a short question - but I am a teacher at heart (and, at times, by vocation)! "Jennifer" wrote: Hello, I want this to run this when i hit a button <add in my form. It works great if the correct worksheet is open, but I don't run the form in this sheet so again how do I tell it to look on the database worksheet? 'checks how many rows have data in l and copies the formula down in m Range("m2", Range("l2").End(xlDown)).Offset(1, 1).FillDown Thanks guys-- Though daily learning, I LOVE EXCEL! Jennifer |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Should be easy but....... | Excel Discussion (Misc queries) | |||
pls help, is there an easy way to | Excel Worksheet Functions | |||
This should be easy... | Excel Worksheet Functions | |||
This should be easy | Excel Worksheet Functions | |||
new user with easy question? not easy for me | New Users to Excel |