PC Review


Reply
Thread Tools Rate Thread

Append existing cell value

 
 
=?Utf-8?B?R25lcmtz?=
Guest
Posts: n/a
 
      22nd Oct 2007
I am working with Excel 2003 - I have a worksheet that loads combo and text
boxes on a user form. I need to be able to take the information (changes) a
user makes and append the specific combo box text box value with the new
value on the worksheet. Code I am using to load the input box from the
worksheet is:

Dim rng As Range
Columns("A:A").Select
Selection.AutoFilter

With Selection
.AutoFilter Field:=1, Criteria1:=frmINPUT.cmbNewProject.Value
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1,
..Columns.Count) _
.SpecialCells(xlCellTypeVisible).Cells(1)
rng.Select
On Error GoTo 0
End With
End With

' With ActiveCell
With Selection

frmINPUT.txtTitle.Value = .Offset(0, 0).Value
frmINPUT.cmbType.Value = .Offset(1, 1).Value
frmINPUT.cmbOffice.Value = .Offset(1, 13).Value
frmINPUT.txtResources.Value = .Offset(1, 126).Value
frmINPUT.txtProjStart.Value = .Offset(1, 2).Value
frmINPUT.txtProjEnd.Value = .Offset(1, 3).Value
frmINPUT.txtActStart.Value = .Offset(1, 4).Value
frmINPUT.txtActEnd.Value = .Offset(1, 5).Value
frmINPUT.cmbCommander.Value = .Offset(1, 9).Value
frmINPUT.cbDeputy.Value = .Offset(1, 128).Value
frmINPUT.cmbFlightChief.Value = .Offset(1, 8).Value
frmINPUT.txtLead.Value = .Offset(1, 6).Value
frmINPUT.txtCoLead.Value = .Offset(1, 11).Value

End With


this works for loading - am at a loss how to append with user changes and
pressing of a SAVE command button.

 
Reply With Quote
 
 
 
 
Nigel
Guest
Posts: n/a
 
      23rd Oct 2007
Hi
Your 'Selection' created after applying the autofilter refers to a worksheet
range, you should be able to reverse the from 'range'-> 'form-control' to
write back the data.

E.g
frmINPUT.cmbType.Value = .Offset(1, 1).Value

becomes

.Offset(1, 1).Value = frmINPUT.cmbType.Value

--

Regards,
Nigel
(E-Mail Removed)



"Gnerks" <(E-Mail Removed)> wrote in message
news:790CF60C-C4E2-4C3A-9411-(E-Mail Removed)...
>I am working with Excel 2003 - I have a worksheet that loads combo and text
> boxes on a user form. I need to be able to take the information (changes)
> a
> user makes and append the specific combo box text box value with the new
> value on the worksheet. Code I am using to load the input box from the
> worksheet is:
>
> Dim rng As Range
> Columns("A:A").Select
> Selection.AutoFilter
>
> With Selection
> .AutoFilter Field:=1, Criteria1:=frmINPUT.cmbNewProject.Value
> With ActiveSheet.AutoFilter.Range
> On Error Resume Next
> Set rng = .Offset(1, 0).Resize(.Rows.Count - 1,
> .Columns.Count) _
> .SpecialCells(xlCellTypeVisible).Cells(1)
> rng.Select
> On Error GoTo 0
> End With
> End With
>
> ' With ActiveCell
> With Selection
>
> frmINPUT.txtTitle.Value = .Offset(0, 0).Value
> frmINPUT.cmbType.Value = .Offset(1, 1).Value
> frmINPUT.cmbOffice.Value = .Offset(1, 13).Value
> frmINPUT.txtResources.Value = .Offset(1, 126).Value
> frmINPUT.txtProjStart.Value = .Offset(1, 2).Value
> frmINPUT.txtProjEnd.Value = .Offset(1, 3).Value
> frmINPUT.txtActStart.Value = .Offset(1, 4).Value
> frmINPUT.txtActEnd.Value = .Offset(1, 5).Value
> frmINPUT.cmbCommander.Value = .Offset(1, 9).Value
> frmINPUT.cbDeputy.Value = .Offset(1, 128).Value
> frmINPUT.cmbFlightChief.Value = .Offset(1, 8).Value
> frmINPUT.txtLead.Value = .Offset(1, 6).Value
> frmINPUT.txtCoLead.Value = .Offset(1, 11).Value
>
> End With
>
>
> this works for loading - am at a loss how to append with user changes and
> pressing of a SAVE command button.
>


 
Reply With Quote
 
=?Utf-8?B?R25lcmtz?=
Guest
Posts: n/a
 
      23rd Oct 2007
Thanks Nigel - i knew it had to be simple just couldn't make it work. This
helps tremendously.

"Nigel" wrote:

> Hi
> Your 'Selection' created after applying the autofilter refers to a worksheet
> range, you should be able to reverse the from 'range'-> 'form-control' to
> write back the data.
>
> E.g
> frmINPUT.cmbType.Value = .Offset(1, 1).Value
>
> becomes
>
> .Offset(1, 1).Value = frmINPUT.cmbType.Value
>
> --
>
> Regards,
> Nigel
> (E-Mail Removed)
>
>
>
> "Gnerks" <(E-Mail Removed)> wrote in message
> news:790CF60C-C4E2-4C3A-9411-(E-Mail Removed)...
> >I am working with Excel 2003 - I have a worksheet that loads combo and text
> > boxes on a user form. I need to be able to take the information (changes)
> > a
> > user makes and append the specific combo box text box value with the new
> > value on the worksheet. Code I am using to load the input box from the
> > worksheet is:
> >
> > Dim rng As Range
> > Columns("A:A").Select
> > Selection.AutoFilter
> >
> > With Selection
> > .AutoFilter Field:=1, Criteria1:=frmINPUT.cmbNewProject.Value
> > With ActiveSheet.AutoFilter.Range
> > On Error Resume Next
> > Set rng = .Offset(1, 0).Resize(.Rows.Count - 1,
> > .Columns.Count) _
> > .SpecialCells(xlCellTypeVisible).Cells(1)
> > rng.Select
> > On Error GoTo 0
> > End With
> > End With
> >
> > ' With ActiveCell
> > With Selection
> >
> > frmINPUT.txtTitle.Value = .Offset(0, 0).Value
> > frmINPUT.cmbType.Value = .Offset(1, 1).Value
> > frmINPUT.cmbOffice.Value = .Offset(1, 13).Value
> > frmINPUT.txtResources.Value = .Offset(1, 126).Value
> > frmINPUT.txtProjStart.Value = .Offset(1, 2).Value
> > frmINPUT.txtProjEnd.Value = .Offset(1, 3).Value
> > frmINPUT.txtActStart.Value = .Offset(1, 4).Value
> > frmINPUT.txtActEnd.Value = .Offset(1, 5).Value
> > frmINPUT.cmbCommander.Value = .Offset(1, 9).Value
> > frmINPUT.cbDeputy.Value = .Offset(1, 128).Value
> > frmINPUT.cmbFlightChief.Value = .Offset(1, 8).Value
> > frmINPUT.txtLead.Value = .Offset(1, 6).Value
> > frmINPUT.txtCoLead.Value = .Offset(1, 11).Value
> >
> > End With
> >
> >
> > this works for loading - am at a loss how to append with user changes and
> > pressing of a SAVE command button.
> >

>

 
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
Sub to append data below existing Max Microsoft Excel Programming 2 2nd Sep 2008 10:37 AM
Append print job to an existing PDF =?Utf-8?B?Q2h1Y2sgTQ==?= Microsoft Excel Programming 0 11th Sep 2007 03:24 PM
How do I create an excel macro to append to a cell with existing i =?Utf-8?B?em9sYV90aWFyYQ==?= Microsoft Excel Misc 4 14th Sep 2005 08:22 PM
How to append existing series? Michael C via OfficeKB.com Microsoft Excel Charting 1 20th Aug 2005 03:17 PM
Append One Existing Table to Another Diana Microsoft Access 1 26th Mar 2004 12:13 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:53 PM.