Solved

Data Refresh Excel in line with manually entered data?

Posted on 2014-01-21
6
290 Views
Last Modified: 2014-01-28
Attached is an example of the worksheet I need to update.

Columns A&B need to come from the database to ensure all the specifications are being addressed and Columns C thru Z are manually entered.

I have the query that refreshes Columns A & B, keeping the sort and I have the vba (not in the example) to insert an empty row on the change of Category.

What I don't have is when A&B are refreshed, how do I keep the manually entered column data with the appropriate Column A&B information?

Also, is it possible to enter the blank rows and populate the Category name (as in the example?)

Thanks for your help....
Worksheet-Example.xlsm
0
Comment
Question by:urthrilled
  • 4
  • 2
6 Comments
 
LVL 10

Expert Comment

by:SANTABABY
ID: 39798552
I can provide a complete and tested solution of you can provide the code/macro that you are using.
Here is something to give you an idea. This code has some holes to handle your section breaks and you need to use markers to define section boundaries in your worksheet and enhance the code accordingly.

Option Base 1
'Items array(2,x) contains Item No and Desc
Sub UpdateSpec(Items() As Variant)
Dim i As Integer, j As Integer, cnt As Integer
Dim ws As Worksheet
  Set ws = ActiveSheet
  i = LBound(Items(1))
  cnt = UBound(Items(1))
  j = 14
  While i <= cnt
    If ws.Cells(j, 1) = "" And ws.Cells(j + 1, 1) <> "" Then j = j + 1
    If Items(1, i) < ws.Cells(j, 1) Or _
        (ws.Cells(j + 1, 1) = "" And (ws.Cells(j + 2, 1) = "" Or Items(1, i) < ws.Cells(j + 2, 1))) Then
        ws.Rows(j).Insert Shift:=xlDown
        ws.Cells(j, 1) = Items(1, i)
        ws.Cells(j, 2) = Items(2, i)
        i = i + 1
        j = j + 1
    ElseIf Items(1, i) < ws.Cells(j, 1) Then
        j = j + 1
        i = i + 1
    Else
        ws.Rows(j).Delete
    End If
  Wend
End Sub
0
 
LVL 4

Author Comment

by:urthrilled
ID: 39798685
I've attached the workbook with Sheet2, which has the sql data and the macro to insert the blank rows.

I only need the 2 columns, SpecNo and Item_Description, but I included the other information to be used in other ways (i.e. the Category_Description is the Group Name that should go in the blank row)

I see in the Properties of the Connection in Excel it has choices to update and/or insert, but I don't believe that's robust enough for this purpose?
0
 
LVL 4

Author Comment

by:urthrilled
ID: 39798689
Oops, I forgot to attach the file....  here it is
Worksheet-Example.xlsm
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 4

Accepted Solution

by:
urthrilled earned 0 total points
ID: 39800654
What do you think about a vba command to insert spec numbers in a coumn that's not included in the refresh so that once the update happens the rows can be sorted and reunited?
0
 
LVL 10

Expert Comment

by:SANTABABY
ID: 39805634
Just got busy with some day long meetings. Very glad to hear that you have a good handle on the issue. Good luck.
0
 
LVL 4

Author Closing Comment

by:urthrilled
ID: 39814572
After working with it, the way to work it out became clear
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now