?
Solved

Data Refresh Excel in line with manually entered data?

Posted on 2014-01-21
6
Medium Priority
?
320 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

764 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