Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8624805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:37:27+00:00 2026-06-12T07:37:27+00:00

Here Is a sample of the table (with creepy sample data) |Col A |Col

  • 0

Here Is a sample of the table (with creepy sample data)

|Col A       |Col B     |Col C   |Col D     |Col E
+------------+----------+--------+----------+-----
|Number      |Value     |X       |Date      |Decimal
|1           |        AA|X       |2012/01/01|.1
|2           |        BB|X       |2012/02/01|.2
|3           |        CC|X       |2012/03/01|.3
|4           |        DD|X       |2012/04/01|.4
|5           |        EE|X       |2012/05/01|.5

What needs to be done:

  • Sort the table according to the “Value”(Col B in this instance) in a macro

Conditions:

  • The header values DOES NOT change
  • I have to search the headers which will contain the word “Value” since it changes from Col C to Col D or Col A… B… E…
  • Column headers ALWAYS stay at 1st row

What I have done so far:

  • Brute force the value…(BAD!)
  • Search the header to find what column contains the header “Value”
  • Get the column letter/number and store in a variable

Problems:

  • Using the column letter or number as basis for sort.
    (i.e. Range (colLetter & “:” & colLetter))

Any help would be appriciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:37:28+00:00Added an answer on June 12, 2026 at 7:37 am
    Sub Tester()
    
    Const SORT_HEADER As String = "Value"
    Dim sht As Worksheet, f As Range
    
    
        Set sht = Worksheets("Sheet1")
    
        Set f = sht.Rows(1).Find(SORT_HEADER, LookIn:=xlValues, lookat:=xlWhole)
    
        If Not f Is Nothing Then
    
            sht.Range("A1").CurrentRegion.Sort _
                Key1:=sht.Columns(f.Column), Order1:=xlAscending, Header:=xlYes
    
        Else
            MsgBox "'" & SORT_HEADER & "' column not found!"
        End If
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Data: Here is sample table(TableA) data ID StartTime EndTime 1 2012-03-22 06:00:00.000 2012-03-22 06:30:00.000
Here is sample data <table class=sparql border=1> <tr> <th>abstract</th></tr> <tr> <td> Cologne is Germany&#39;s
Here is the sample data for test table I have [childId] [parentId] [present] 1
## Sample Table ## Here are some particulars concerning proposed problem. ROWID = _id;
Here is my sample query: SELECT userid,count(*) FROM hits GROUP BY userid My table
Here's a sample table <table width=580 height=217 border=0 cellpadding=0 cellspacing=0> <tr> <td width=334>Website</td> <td
Here's a sample database table : | ID | ProductID | DateChanged | Price
Here a sample dataset: OrderProduct is a table that contains the productIds that were
I have here sample table with three fields. TableA FieldA FieldB FieldC ====================================== 123XYZ456
Here's a sample table to help illustrate my problem: mysql> select * from test;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.