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

  • SEARCH
  • Home
  • 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 7503057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:05:28+00:00 2026-05-29T21:05:28+00:00

I’m hoping that I can explain this well enough. I have an excel document

  • 0

I’m hoping that I can explain this well enough.
I have an excel document which has been laid out as such;

     A      B      C      D     ...     n
1 [     ][  H  ][  H  ][  H  ][ ... ][  H  ]
2 [     ][  T  ][  T  ][  T  ][ ... ][  T  ]
3 [  C  ][  D  ][  D  ][  D  ][ ... ][  D  ]
4 [  C  ][  D  ][  D  ][  D  ][ ... ][  D  ]
5 [  C  ][  D  ][  D  ][  D  ][ ... ][  D  ]
. [ ... ][ ... ][ ... ][ ... ][ ... ][  D  ]
n [  C  ][  D  ][  D  ][  D  ][  D  ][  D  ]

H: Major header
T: Title
C: Side Header
D: Data (Some may also be blank)

I need to convert this into a format that can be utilised by a database. I know what I want to convert it to, but I do not know how to do it (with vba or any other alternative).
What I would like is;

     A      B      C      D
1 [  C  ][  T  ][  H  ][  D  ]
2 [  C  ][  T  ][  H  ][  D  ]
3 [  C  ][  T  ][  H  ][  D  ]
. [ ... ][ ... ][ ... ][ ... ]
n [  C  ][  T  ][  H  ][  D  ]

How I think it could be done is to loop through the viable region (all of the ‘Data’ represented as ‘D’), checking to make sure that is contains data in it (if not do not print that line), and then getting its respective headers and printing out the end products, either by overwriting the previous data or putting it onto a different sheet.

Thanks! Any help is appreciated.

  • 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-05-29T21:05:29+00:00Added an answer on May 29, 2026 at 9:05 pm

    here is a full working code (in my sample at least):

    Option Explicit
    
    Sub convert_for_DB()
    Dim lLastRow As Long, lLastCol As Long
    Dim c As Range
    Dim index As Long
    Dim aH As Variant, aT As Variant, aC As Variant
    Dim vValues() As Variant
    
    With Worksheets("Sheet1")
        'find the last row and the last col
        lLastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
        lLastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
        'get the headers
        aH = .Range("B1", .Cells(1, lLastCol)).Value
        aT = .Range("B2", .Cells(2, lLastCol)).Value
        aC = .Range("A3", .Cells(lLastRow, 1)).Value
        'create an array with the number of values
        ReDim vValues((lLastRow - 2) * (lLastCol - 1), 3)
    
        index = 0
        'parse every value of the array
        For Each c In .Range("B3", .Cells(lLastRow, lLastCol))
            If Len(c.Value) > 0 Then
                vValues(index, 0) = aC(c.Row - 2, 1)
                vValues(index, 1) = aH(1, c.Column - 1)
                vValues(index, 2) = aT(1, c.Column - 1)
                vValues(index, 3) = c.Value
                index = index + 1
            End If
        Next c
    End With
    
    'store back the data to another sheet
    With Worksheets("Sheet2")
        .Range("A1", .Cells(UBound(vValues, 1), 4)) = vValues
    End With
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from

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.