• Hello there guest and Welcome to The #1 Classic Mustang forum!
    To gain full access you must Register. Registration is free and it takes only a few moments to complete.
    Already a member? Login here then!

Any Excel programmers out there?

FordDude

Well-Known Dude
Staff member
Moderator
I am a novice with excel programming. I can do simple things. But the formula I need to use is going to look like an algebra formula from my high school days 40+ years ago.
Simply put 4 columns, first being the store number then the city and address. I want the store numbers to be in numeral order no matter how I enter them. So the entire row needs to shift position. Anyone?

img590026f12a96c.jpg

Just for looking here is a playboy playmate waiting for you...

fd
 
Last edited:
Can't you just add a filter to all 4 columns and turn the first column filter to sort smallest to largest? The filter has to be at the top row of all 4 to keep the info together for each store.

Sent from my XT1053 using Tapatalk
 
I tweaked a little code via google search... This immediately sorts column A as soon as you enter a value into column A.

Maybe this will get you started. Drop this code into "Sheet 1" using the VBA Project editor.
You will probably need to activate the developer tab in the excel ribbon.

Once pasted, just go into sheet 1 and type numbers into column a.

Private Sub Worksheet_Change(ByVal Target As Range)
cur_cell_row = ActiveCell.Row
cur_cell_col = ActiveCell.Column

Dim KeyCells As Range

' The variable KeyCells contains the cells that will
' cause an alert when they are changed.
Set KeyCells = Range("A1:C100000")

If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
sort_a
End If

Cells(cur_cell_row, cur_cell_col).Select

End Sub

Sub sort_a()
Columns("A:A").Select
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("A1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A2:D100")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With

End Sub

Do I win the prize :):)
 
Can't you just add a filter to all 4 columns and turn the first column filter to sort smallest to largest? The filter has to be at the top row of all 4 to keep the info together for each store.

Sent from my XT1053 using Tapatalk

What I started with was merging cells (bcd) (efg) and (hi). So when I do the filter thing it is giving me a raspberry and saying the cells need to be the same size. So I started over and dragged the cells to make them longer. It does work now, but I will have to highlight the whole page to get them in order. This company is adding stores, and I wanted to add at the bottom hit enter and have it find its place. This will work for now. Thanks...

fd
 
I tweaked a little code via google search... This immediately sorts column A as soon as you enter a value into column A.

Maybe this will get you started. Drop this code into "Sheet 1" using the VBA Project editor.
You will probably need to activate the developer tab in the excel ribbon.

Once pasted, just go into sheet 1 and type numbers into column a.

Private Sub Worksheet_Change(ByVal Target As Range)
cur_cell_row = ActiveCell.Row
cur_cell_col = ActiveCell.Column

Dim KeyCells As Range

' The variable KeyCells contains the cells that will
' cause an alert when they are changed.
Set KeyCells = Range("A1:C100000")

If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
sort_a
End If

Cells(cur_cell_row, cur_cell_col).Select

End Sub

Sub sort_a()
Columns("A:A").Select
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("A1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortTextAsNumbers
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A2:D100")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With

End Sub

Do I win the prize :):)

We are all winners here at the Fix. I will give it a try. Tanks

200.webp


fd
 
Wait, there was question in there.

Column A , hot red head?
Did I get it right?

Sent from my XT1058 using Tapatalk
I don't know what mumbo jumbo they are rambling about but but I scrolled down to see if there was more pics and there was all this weird typing stuff...
 
Back
Top