Solved

Data Refresh Excel in line with manually entered data?

Posted on 2014-01-21
6
315 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

705 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