PC Review


Reply
Thread Tools Rate Thread

Automating Data Entry (Position the cursor, insert row)

 
 
=?Utf-8?B?QmV0aGFueQ==?=
Guest
Posts: n/a
 
      28th Nov 2006
I have a very simple spreadsheet I'm using to collect data for establishing
metrics. The spreadsheet is only 4 columns (one for the date, two that are
validated using drown-down lists, and the last is a text column for
description/comments).

I'd like to automate it so that when the user presses enter when in the last
column in the row (D),

1) the focus is returned to the first column in the same row, and
2) a new row is inserted above

thus placing the cursor in the first column of the new row, i.e., ready for
user input.

I understnad the logic for making it happen but don't have the slightest
idea of how to actually make it happen.

Can anyone help?

Thanks!
 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      28th Nov 2006
Right click sheet tab>view code>insert this. Now when you make an entry in
column D the macro will fire.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 4 Then Exit Sub
With Cells(Target.Row, 1)
..Select
..EntireRow.Insert
End With
End Sub

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"Bethany" <(E-Mail Removed)> wrote in message
news:1CAE1F4F-B2F8-492B-AEC3-(E-Mail Removed)...
>I have a very simple spreadsheet I'm using to collect data for establishing
> metrics. The spreadsheet is only 4 columns (one for the date, two that
> are
> validated using drown-down lists, and the last is a text column for
> description/comments).
>
> I'd like to automate it so that when the user presses enter when in the
> last
> column in the row (D),
>
> 1) the focus is returned to the first column in the same row, and
> 2) a new row is inserted above
>
> thus placing the cursor in the first column of the new row, i.e., ready
> for
> user input.
>
> I understnad the logic for making it happen but don't have the slightest
> idea of how to actually make it happen.
>
> Can anyone help?
>
> Thanks!



 
Reply With Quote
 
=?Utf-8?B?QmV0aGFueQ==?=
Guest
Posts: n/a
 
      28th Nov 2006
Don,

Thanks for the code snippet - I'm getting a syntax error, though. It seems
to be bombing on the "..Select" line. Any ideas?


"Don Guillett" wrote:

> Right click sheet tab>view code>insert this. Now when you make an entry in
> column D the macro will fire.
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> If Target.Column <> 4 Then Exit Sub
> With Cells(Target.Row, 1)
> ..Select
> ..EntireRow.Insert
> End With
> End Sub
>
> --
> Don Guillett
> SalesAid Software
> (E-Mail Removed)
> "Bethany" <(E-Mail Removed)> wrote in message
> news:1CAE1F4F-B2F8-492B-AEC3-(E-Mail Removed)...
> >I have a very simple spreadsheet I'm using to collect data for establishing
> > metrics. The spreadsheet is only 4 columns (one for the date, two that
> > are
> > validated using drown-down lists, and the last is a text column for
> > description/comments).
> >
> > I'd like to automate it so that when the user presses enter when in the
> > last
> > column in the row (D),
> >
> > 1) the focus is returned to the first column in the same row, and
> > 2) a new row is inserted above
> >
> > thus placing the cursor in the first column of the new row, i.e., ready
> > for
> > user input.
> >
> > I understnad the logic for making it happen but don't have the slightest
> > idea of how to actually make it happen.
> >
> > Can anyone help?
> >
> > Thanks!

>
>
>

 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      28th Nov 2006
It's not two dots
...
it is ONE dot
..

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"Bethany" <(E-Mail Removed)> wrote in message
news:72CF0EE8-EF5A-4ADE-9BA0-(E-Mail Removed)...
> Don,
>
> Thanks for the code snippet - I'm getting a syntax error, though. It
> seems
> to be bombing on the "..Select" line. Any ideas?
>
>
> "Don Guillett" wrote:
>
>> Right click sheet tab>view code>insert this. Now when you make an entry
>> in
>> column D the macro will fire.
>>
>> Private Sub Worksheet_Change(ByVal Target As Range)
>> If Target.Column <> 4 Then Exit Sub
>> With Cells(Target.Row, 1)
>> ..Select
>> ..EntireRow.Insert
>> End With
>> End Sub
>>
>> --
>> Don Guillett
>> SalesAid Software
>> (E-Mail Removed)
>> "Bethany" <(E-Mail Removed)> wrote in message
>> news:1CAE1F4F-B2F8-492B-AEC3-(E-Mail Removed)...
>> >I have a very simple spreadsheet I'm using to collect data for
>> >establishing
>> > metrics. The spreadsheet is only 4 columns (one for the date, two that
>> > are
>> > validated using drown-down lists, and the last is a text column for
>> > description/comments).
>> >
>> > I'd like to automate it so that when the user presses enter when in the
>> > last
>> > column in the row (D),
>> >
>> > 1) the focus is returned to the first column in the same row, and
>> > 2) a new row is inserted above
>> >
>> > thus placing the cursor in the first column of the new row, i.e., ready
>> > for
>> > user input.
>> >
>> > I understnad the logic for making it happen but don't have the
>> > slightest
>> > idea of how to actually make it happen.
>> >
>> > Can anyone help?
>> >
>> > Thanks!

>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?QmV0aGFueQ==?=
Guest
Posts: n/a
 
      28th Nov 2006
Don,

Thanks! That did it! I really need to learn VBA - I just never seem to
have the time! Thanks, again

"Don Guillett" wrote:

> It's not two dots
> ...
> it is ONE dot
> ..
>
> --
> Don Guillett
> SalesAid Software
> (E-Mail Removed)
> "Bethany" <(E-Mail Removed)> wrote in message
> news:72CF0EE8-EF5A-4ADE-9BA0-(E-Mail Removed)...
> > Don,
> >
> > Thanks for the code snippet - I'm getting a syntax error, though. It
> > seems
> > to be bombing on the "..Select" line. Any ideas?
> >
> >
> > "Don Guillett" wrote:
> >
> >> Right click sheet tab>view code>insert this. Now when you make an entry
> >> in
> >> column D the macro will fire.
> >>
> >> Private Sub Worksheet_Change(ByVal Target As Range)
> >> If Target.Column <> 4 Then Exit Sub
> >> With Cells(Target.Row, 1)
> >> ..Select
> >> ..EntireRow.Insert
> >> End With
> >> End Sub
> >>
> >> --
> >> Don Guillett
> >> SalesAid Software
> >> (E-Mail Removed)
> >> "Bethany" <(E-Mail Removed)> wrote in message
> >> news:1CAE1F4F-B2F8-492B-AEC3-(E-Mail Removed)...
> >> >I have a very simple spreadsheet I'm using to collect data for
> >> >establishing
> >> > metrics. The spreadsheet is only 4 columns (one for the date, two that
> >> > are
> >> > validated using drown-down lists, and the last is a text column for
> >> > description/comments).
> >> >
> >> > I'd like to automate it so that when the user presses enter when in the
> >> > last
> >> > column in the row (D),
> >> >
> >> > 1) the focus is returned to the first column in the same row, and
> >> > 2) a new row is inserted above
> >> >
> >> > thus placing the cursor in the first column of the new row, i.e., ready
> >> > for
> >> > user input.
> >> >
> >> > I understnad the logic for making it happen but don't have the
> >> > slightest
> >> > idea of how to actually make it happen.
> >> >
> >> > Can anyone help?
> >> >
> >> > Thanks!
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Cursor position at new record entry Keith Wilby Microsoft Access Forms 3 22nd May 2009 11:35 AM
Insert text @ cursor position Sean Microsoft Outlook VBA Programming 1 6th Jul 2004 06:25 PM
Insert text at cursor position =?Utf-8?B?U2VsZ2lu?= Microsoft Outlook VBA Programming 2 29th Jan 2004 03:56 PM
Insert text at cursor position...still Matt Tapia Microsoft ASP .NET 1 1st Dec 2003 05:12 PM
Insert text at cursor position Matt Tapia Microsoft ASP .NET 1 26th Nov 2003 11:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:35 PM.