Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Inserting cells

I have a list that is organized alphabetically in a column. I want the user
to enter an item to add to the list in a text box, then click a button to
have the text box information added to my list. How do I INSERT the
information into the list in alphabetical order and keep all original list
data? Then, how would I go about deleting an item in the same manner?
--
Tyrell Fickenscher
Plant Manager / Agronomist
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Inserting cells

The simplest way would be to insert the new data at the bottom of
the list and resort.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Tyrell" wrote in message
...
I have a list that is organized alphabetically in a column. I
want the user
to enter an item to add to the list in a text box, then click a
button to
have the text box information added to my list. How do I
INSERT the
information into the list in alphabetical order and keep all
original list
data? Then, how would I go about deleting an item in the same
manner?
--
Tyrell Fickenscher
Plant Manager / Agronomist



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Inserting cells

I also think Chip's way is the simplest.
this one is not simple way. besides, not case sensitive.
and the list must always be alphabetically ascending order.
about deleting list, i'm not sure your way, but i assumed to delete only
when match.
in both cases, presuming the list is in colunm A

Sub insertlist()
Dim strin, s
Dim stcell As Range, lsrange As Range
Const cl = "a" '<<== column data in and Change here

On Error Resume Next
strin = Application.InputBox("input data", 1 + 2)
If VarType(strin) = vbBoolean Then
Exit Sub
End If

Set stcell = Cells(1, cl)
Set lscell = Cells(Cells(Cells.Rows.count, cl).End(xlUp).Row, cl)
s = Application.Match(strin, Range(stcell, lscell))
If Not IsError(s) Then
stcell(s + 1).EntireRow.Insert
stcell(s + 1) = strin
Else
stcell.EntireRow.Insert
stcell(0) = strin
End If
End Sub

Sub deletelist()
Dim strin, s
Dim stcell As Range, lsrange As Range
Const cl = "a" '<<== column data in and Change here

On Error Resume Next
strin = Application.InputBox("input data", 1 + 2)
If VarType(strin) = vbBoolean Then
Exit Sub
End If

Set stcell = Cells(1, cl)
Set lscell = Cells(Cells(Cells.Rows.count, cl).End(xlUp).Row, cl)
s = Application.Match(strin, Range(stcell, lscell), 0)
If Not IsError(s) Then
stcell(s).EntireRow.Delete
Else
MsgBox "data[ " & strin & " ] not found"
End If
End Sub

keizi

"Tyrell" wrote in message
...
I have a list that is organized alphabetically in a column. I want

the user
to enter an item to add to the list in a text box, then click a button

to
have the text box information added to my list. How do I INSERT the
information into the list in alphabetical order and keep all original

list
data? Then, how would I go about deleting an item in the same manner?
--
Tyrell Fickenscher
Plant Manager / Agronomist


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
Blocked from Inserting individual cells or Insert Cut Cells Ching-AHS Excel Discussion (Misc queries) 0 December 1st 09 05:47 PM
inserting clip art into cells econ Excel Discussion (Misc queries) 4 June 8th 07 03:40 AM
Inserting cells between cells with text Cynthia Excel Discussion (Misc queries) 4 March 30th 06 07:55 PM
Inserting text to certain cells Tom Ogilvy Excel Programming 0 July 27th 04 05:58 PM
Inserting HTML into cells Backslider Excel Programming 0 February 26th 04 07:48 PM


All times are GMT +1. The time now is 08:22 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"