Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dar Dar is offline
external usenet poster
 
Posts: 25
Default open excel from Access


I have Access 2000, with Excel on a Shared Drive.
I need to open a specific wkbk "ClinicTECList.xls" on the N: drive
I need to be able to loop through the 9 wksh and go to Column D and delete any
row (s) that have a Date earlier than today.
Most importantly, I NEED HELP in the coding, down to the basics.

Help would be appreciated.
Other forum sent me here. If code is supplied, please indicate where I
place it and
how I activate the code.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default open excel from Access

You have Access 2000
You have Excel 2000

From which application do you want to run code that does what you describe?
If you can do it from Excel it will be much simpler.


--
Regards,
Tom Ogilvy


"dar" wrote in message
...

I have Access 2000, with Excel on a Shared Drive.
I need to open a specific wkbk "ClinicTECList.xls" on the N: drive
I need to be able to loop through the 9 wksh and go to Column D and delete

any
row (s) that have a Date earlier than today.
Most importantly, I NEED HELP in the coding, down to the basics.

Help would be appreciated.
Other forum sent me here. If code is supplied, please indicate where I
place it and
how I activate the code.



  #3   Report Post  
Posted to microsoft.public.excel.programming
Dar Dar is offline
external usenet poster
 
Posts: 25
Default open excel from Access

I will do it from either. If Excel is simpler, I'm all for that.
Thank you in advance for any help you provide.

"Tom Ogilvy" wrote:

You have Access 2000
You have Excel 2000

From which application do you want to run code that does what you describe?
If you can do it from Excel it will be much simpler.


--
Regards,
Tom Ogilvy


"dar" wrote in message
...

I have Access 2000, with Excel on a Shared Drive.
I need to open a specific wkbk "ClinicTECList.xls" on the N: drive
I need to be able to loop through the 9 wksh and go to Column D and delete

any
row (s) that have a Date earlier than today.
Most importantly, I NEED HELP in the coding, down to the basics.

Help would be appreciated.
Other forum sent me here. If code is supplied, please indicate where I
place it and
how I activate the code.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default open excel from Access

Run this from Excel. (see caution at the bottom).

Open Excel ( a new workbook should be created)
do Alt+F11 to get to the VBE
in the menu do Insert = Module
In the resulting module paste the below code.
(modify the code to reflect the path to the workbook if necessary)
do Alt+F11 to get back
Save the file

go to the tools menu and do

Macro=Macros
ProcessWorkbook should be highlighted (if not highlight it), then click run.

This will open the ClinicTECList workbook and delete the appropriate rows
on all sheets in the workbook.

Sub ProcessWorkbook()
Dim bk As Workbook, sh As Worksheet
Dim rng As Range, lastrow As Long
Set bk = Workbooks.Open("N:\ClinicTECList.xls")
For Each sh In bk.Worksheets
lastrow = sh.Cells(Rows.Count, 4).End(xlUp)
For i = lastrow To 1 Step -1
Set rng = sh.Cells(i, 4)
If Not IsEmpty(rng) Then
If IsDate(rng) Then
If rng < Date Then
rng.EntireRow.Delete
End If
End If
End If
Next
Next
End Sub


Since you are deleting data, make a copy of your workbook before testing the
macro.

--
Regards,
Tom Ogilvy



"dar" wrote in message
...
I will do it from either. If Excel is simpler, I'm all for that.
Thank you in advance for any help you provide.

"Tom Ogilvy" wrote:

You have Access 2000
You have Excel 2000

From which application do you want to run code that does what you

describe?
If you can do it from Excel it will be much simpler.


--
Regards,
Tom Ogilvy


"dar" wrote in message
...

I have Access 2000, with Excel on a Shared Drive.
I need to open a specific wkbk "ClinicTECList.xls" on the N: drive
I need to be able to loop through the 9 wksh and go to Column D and

delete
any
row (s) that have a Date earlier than today.
Most importantly, I NEED HELP in the coding, down to the basics.

Help would be appreciated.
Other forum sent me here. If code is supplied, please indicate where

I
place it and
how I activate the code.






  #5   Report Post  
Posted to microsoft.public.excel.programming
Dar Dar is offline
external usenet poster
 
Posts: 25
Default open excel from Access

When I try to run the Macro, it gives me an error message of
"Type mismatch" and it highlights the row
lastrow = sh.Cells(Rows.Count,4).End(xlUp)
when I put the cursur over Count it read 65536 and when I put if over xlUp
it reads -4162. Over lastrow it reads lastrow = 0


"Tom Ogilvy" wrote:

Run this from Excel. (see caution at the bottom).

Open Excel ( a new workbook should be created)
do Alt+F11 to get to the VBE
in the menu do Insert = Module
In the resulting module paste the below code.
(modify the code to reflect the path to the workbook if necessary)
do Alt+F11 to get back
Save the file

go to the tools menu and do

Macro=Macros
ProcessWorkbook should be highlighted (if not highlight it), then click run.

This will open the ClinicTECList workbook and delete the appropriate rows
on all sheets in the workbook.

Sub ProcessWorkbook()
Dim bk As Workbook, sh As Worksheet
Dim rng As Range, lastrow As Long
Set bk = Workbooks.Open("N:\ClinicTECList.xls")
For Each sh In bk.Worksheets
lastrow = sh.Cells(Rows.Count, 4).End(xlUp)
For i = lastrow To 1 Step -1
Set rng = sh.Cells(i, 4)
If Not IsEmpty(rng) Then
If IsDate(rng) Then
If rng < Date Then
rng.EntireRow.Delete
End If
End If
End If
Next
Next
End Sub


Since you are deleting data, make a copy of your workbook before testing the
macro.

--
Regards,
Tom Ogilvy



"dar" wrote in message
...
I will do it from either. If Excel is simpler, I'm all for that.
Thank you in advance for any help you provide.

"Tom Ogilvy" wrote:

You have Access 2000
You have Excel 2000

From which application do you want to run code that does what you

describe?
If you can do it from Excel it will be much simpler.


--
Regards,
Tom Ogilvy


"dar" wrote in message
...

I have Access 2000, with Excel on a Shared Drive.
I need to open a specific wkbk "ClinicTECList.xls" on the N: drive
I need to be able to loop through the 9 wksh and go to Column D and

delete
any
row (s) that have a Date earlier than today.
Most importantly, I NEED HELP in the coding, down to the basics.

Help would be appreciated.
Other forum sent me here. If code is supplied, please indicate where

I
place it and
how I activate the code.








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default open excel from Access

lastrow = sh.Cells(Rows.Count,4).End(xlUp)
should be

lastrow = sh.Cells(Rows.Count,4).End(xlUp).Row

--
Regards,
Tom Ogilvy

"dar" wrote in message
...
When I try to run the Macro, it gives me an error message of
"Type mismatch" and it highlights the row
lastrow = sh.Cells(Rows.Count,4).End(xlUp)
when I put the cursur over Count it read 65536 and when I put if over

xlUp
it reads -4162. Over lastrow it reads lastrow = 0


"Tom Ogilvy" wrote:

Run this from Excel. (see caution at the bottom).

Open Excel ( a new workbook should be created)
do Alt+F11 to get to the VBE
in the menu do Insert = Module
In the resulting module paste the below code.
(modify the code to reflect the path to the workbook if necessary)
do Alt+F11 to get back
Save the file

go to the tools menu and do

Macro=Macros
ProcessWorkbook should be highlighted (if not highlight it), then click

run.

This will open the ClinicTECList workbook and delete the appropriate

rows
on all sheets in the workbook.

Sub ProcessWorkbook()
Dim bk As Workbook, sh As Worksheet
Dim rng As Range, lastrow As Long
Set bk = Workbooks.Open("N:\ClinicTECList.xls")
For Each sh In bk.Worksheets
lastrow = sh.Cells(Rows.Count, 4).End(xlUp)
For i = lastrow To 1 Step -1
Set rng = sh.Cells(i, 4)
If Not IsEmpty(rng) Then
If IsDate(rng) Then
If rng < Date Then
rng.EntireRow.Delete
End If
End If
End If
Next
Next
End Sub


Since you are deleting data, make a copy of your workbook before testing

the
macro.

--
Regards,
Tom Ogilvy



"dar" wrote in message
...
I will do it from either. If Excel is simpler, I'm all for that.
Thank you in advance for any help you provide.

"Tom Ogilvy" wrote:

You have Access 2000
You have Excel 2000

From which application do you want to run code that does what you

describe?
If you can do it from Excel it will be much simpler.


--
Regards,
Tom Ogilvy


"dar" wrote in message
...

I have Access 2000, with Excel on a Shared Drive.
I need to open a specific wkbk "ClinicTECList.xls" on the N: drive
I need to be able to loop through the 9 wksh and go to Column D

and
delete
any
row (s) that have a Date earlier than today.
Most importantly, I NEED HELP in the coding, down to the basics.

Help would be appreciated.
Other forum sent me here. If code is supplied, please indicate

where
I
place it and
how I activate the code.








  #7   Report Post  
Posted to microsoft.public.excel.programming
Dar Dar is offline
external usenet poster
 
Posts: 25
Default open excel from Access

Thank you, that worked.


"Tom Ogilvy" wrote:

lastrow = sh.Cells(Rows.Count,4).End(xlUp)
should be

lastrow = sh.Cells(Rows.Count,4).End(xlUp).Row

--
Regards,
Tom Ogilvy

"dar" wrote in message
...
When I try to run the Macro, it gives me an error message of
"Type mismatch" and it highlights the row
lastrow = sh.Cells(Rows.Count,4).End(xlUp)
when I put the cursur over Count it read 65536 and when I put if over

xlUp
it reads -4162. Over lastrow it reads lastrow = 0


"Tom Ogilvy" wrote:

Run this from Excel. (see caution at the bottom).

Open Excel ( a new workbook should be created)
do Alt+F11 to get to the VBE
in the menu do Insert = Module
In the resulting module paste the below code.
(modify the code to reflect the path to the workbook if necessary)
do Alt+F11 to get back
Save the file

go to the tools menu and do

Macro=Macros
ProcessWorkbook should be highlighted (if not highlight it), then click

run.

This will open the ClinicTECList workbook and delete the appropriate

rows
on all sheets in the workbook.

Sub ProcessWorkbook()
Dim bk As Workbook, sh As Worksheet
Dim rng As Range, lastrow As Long
Set bk = Workbooks.Open("N:\ClinicTECList.xls")
For Each sh In bk.Worksheets
lastrow = sh.Cells(Rows.Count, 4).End(xlUp)
For i = lastrow To 1 Step -1
Set rng = sh.Cells(i, 4)
If Not IsEmpty(rng) Then
If IsDate(rng) Then
If rng < Date Then
rng.EntireRow.Delete
End If
End If
End If
Next
Next
End Sub


Since you are deleting data, make a copy of your workbook before testing

the
macro.

--
Regards,
Tom Ogilvy



"dar" wrote in message
...
I will do it from either. If Excel is simpler, I'm all for that.
Thank you in advance for any help you provide.

"Tom Ogilvy" wrote:

You have Access 2000
You have Excel 2000

From which application do you want to run code that does what you
describe?
If you can do it from Excel it will be much simpler.


--
Regards,
Tom Ogilvy


"dar" wrote in message
...

I have Access 2000, with Excel on a Shared Drive.
I need to open a specific wkbk "ClinicTECList.xls" on the N: drive
I need to be able to loop through the 9 wksh and go to Column D

and
delete
any
row (s) that have a Date earlier than today.
Most importantly, I NEED HELP in the coding, down to the basics.

Help would be appreciated.
Other forum sent me here. If code is supplied, please indicate

where
I
place it and
how I activate the code.









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
EXCEL TRIES TO OPEN IN ACCESS cfarns Excel Discussion (Misc queries) 2 September 20th 07 01:50 AM
Excel cannot open Access MDB Neva Excel Discussion (Misc queries) 0 April 4th 05 08:35 PM
help to open pwd Excel from Access Ed Excel Programming 1 June 30th 04 01:56 PM
Open Access db from Excel Will[_7_] Excel Programming 0 May 13th 04 09:32 PM
Open Excel from access John[_46_] Excel Programming 4 September 8th 03 05:44 PM


All times are GMT +1. The time now is 03:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"