Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
M H M H is offline
external usenet poster
 
Posts: 28
Default Use Excel as Access

I would like to accomplish a couple of MS Access features in Excel:
1. Primary Key - automatic numbering of entries in rows without
replication allowance. Part of it is solved with data validation using
=COUNTIF function, right?
2. Date formatting - when you tab to the column for date entry, a guide
like "____-__-__" will popup and I just need to type in 20050721.
Please advice.


*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Use Excel as Access

(1) use the change event to test if a new row has been added to a table, the
event then can increment the "primary key" automatically....
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim newval As Long
'test if its in the table
If Range("C1").End(xlDown).Address = Target.Address Then

If Target.Offset(0, -1).Value = "" Then

newval = Target.Offset(-1, -1).Value + 1

Do While WorksheetFunction.CountIf(Range("B:B"), newval) 0
newval = newval + 1
Loop

Target.Offset(0, -1).Value = newval

End If

End If

End Sub

(2) use the selection change event to open a Userform - this can be set up
any way that you want.

"M H" wrote:

I would like to accomplish a couple of MS Access features in Excel:
1. Primary Key - automatic numbering of entries in rows without
replication allowance. Part of it is solved with data validation using
=COUNTIF function, right?
2. Date formatting - when you tab to the column for date entry, a guide
like "____-__-__" will popup and I just need to type in 20050721.
Please advice.


*** Sent via Developersdex http://www.developersdex.com ***

  #3   Report Post  
Posted to microsoft.public.excel.programming
M H M H is offline
external usenet poster
 
Posts: 28
Default Use Excel as Access

Hi Pat,
Your code work superbly! Thanks!



*** Sent via Developersdex http://www.developersdex.com ***
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
Query from Access into Excel cause Access to go to read only T Stephens Excel Discussion (Misc queries) 0 March 24th 09 04:17 PM
Can Excel access data from Access?! Al Excel Discussion (Misc queries) 5 April 5th 08 03:52 PM
export access to excel. change access & update excel at same time fastcar Excel Discussion (Misc queries) 0 June 24th 05 09:27 PM
Access data -work in Excel- save in Access s_u_resh Excel Programming 1 October 25th 04 12:52 PM
Getting Access Error Messages when running Access through Excel Dkline[_2_] Excel Programming 0 October 12th 04 09:35 PM


All times are GMT +1. The time now is 07:27 PM.

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

About Us

"It's about Microsoft Excel"