I have empty cells in a sql table that I would like to populate at one time. I have an excel spreadsheet with the corresponding numbers that need to go in the empty cells. I would like to take the spreadsheet and use it to populate the empty cells in ssms.
Excel Spreadsheet
Based on what I've read I need to make an update script that will take the spreadsheet and say, "where you find a matching OBJECTID update the number from STAND_OPER_CODE(spreadsheet) to the STAND_OPER_CODE(SSMS)"
SSMS
Related
I'm looking to build a VBA to delete the entire row of a table in access if a certain column is empty, lets call the column "services". This would have run on a loop so anytime data was added it would check, if possible. I am using an auto-generated ID in a different column if that changes anything. Thanks in advance
When importing the data into access from excel, modify your query to not pull any information when that cell is null.
If you are not using a query and just a range selection, I would loop through each row looking for the null value, if it is not null then copy the row to another sheet inside the excel workbook and export that worksheet once the loop is finished.
( I would have commented but do not have enough rep )
I am trying to build a query that populates data in a column in a similar way to how an index, match or vlookup works.
My workbook has 2 sheets:
Contains open order data pulled from SQL (SQL_Data)
Contains saved comments that were manually entered on the SQL sheet (Preserved_Comments)
I have two queries set up:
Saves the order number and the manually input comments from the SQL_Data sheet, and puts them in a table on the Preserved_Comments Sheet
Refreshes the SQL data table
I have been trying to add a 3rd query that adds the comment column back into the SQL_Data sheet, but I can't figure out how to do a join / index, match / Vlookup that looks at the order numbers and populates the saved comment.
My goal for this is to create an order report where when the SQL data is refreshed, the manually added comments are saved and follow the order number.
Any guidance would be appreciated!
You can merge both Queries into a new one. Use a key column, It would be the lookup array in INDEX/MATCH. This should allow you to join the column.
Frequently in my job I need to generate reports with lots of tables of inputs and results. Especially for the result tables, one change in analysis may require editing a dozen spreadsheets. I'd like to create a macro in word that pulls in data from a spreadsheet, with each table on it's own tab, so that if I update any of those tables in excel the word document tables will also update. Given the number of tables/data points, I don't want to have to tell the macro to pull each single data point. The aim would be to reduce time and errors from manual entry.
I'm thinking this would involve the following steps, but not sure how to go about them:
1) Define the name/size for each table in word with matching name/size in excel
2) Tell the macro to pull the data into a table format
I'm not sure if this is possible as so far I've only seen how to insert a caption or a text box, not insert or update entire tables. Any help would be greatly appreciated!
Depending on what you're doing, you may not even need any VBA code.
If you copy a range from Excel and paste it into Word using Paste Special with the 'paste link' option, any subsequent changes in the Excel range will automatically be reflected in the document when the workbook is saved. And, if you name the range in Excel before copying/pasting, the Word content will expend/contract to reflect changes in the named range's scope in Excel. A variety of paste formats is supported.
Alternatively, you might use a DATABASE field in Word.
I am just a beginner in VBA. I am trying to copy some data from one workbook that is updated daily to a master woorkbook and generate a report. I want it to first filter one of the columns for nonzero values and copy it with three selected columns for example columns T,C,N. I have looked everywhere for an answer but I haven't succeeded yet. Please help.
You can check if a given cell has value 0 by something like this If Sheets(sheetname).Cells(rownumber,columnnumber)=0 Then
You haven't specified what do you want to do on the other workbooks with the cells that were empty.
I have an Excel spreadsheet with two sheets, Sheet 1 contains some text and formulas I wish to duplicate down to write 2,000 odd lines of C# code for my project. Extremely repetitive, so I thought I could use Excel to write it for me. Sheet 2 contains an extract from my database which I wish to use to populate that values with. My section of Excel code looks like this and is spread out over 10 rows and 5 columns:
new AccountingPeriod()
{
MonthCovered="=Sheet2!B2",
StartDate=DateTime.Parse("Sheet2!C2"),
EndDate=DateTime.Parse("Sheet2!D2"),
AccountingPeriodDescription="Sheet2!E2",
Active='=Sheet2!F2',
April='=Sheet2!G2,
TaxYear="Sheet2!H2"
},
When I highlight these 10 rows and use the Excel duplicate tool I want the cell references (for example, in my spreadsheet Sheet1!D3 = Sheet2!B2, I want Sheet1!D13 = Sheet2!B3 NOT Sheet2!B13) to increment by 1, not 10 as it's doing in my spreadsheet.
We have tried an alternative solution of writing a macro to insert 10 blank rows in Sheet2 for every populated row so that the duplicated references are correct in Sheet1 but we're currently failing miserably at getting that to work correctly.
Instead of a direct reference that is going to change on a 1-to-1 with the copy, use the INDEX function with a little maths to achieve the 10-to-1 row stagger.
In Sheet1!D3 this references Sheet2!B2.
=INDEX(Sheet2!B:B,INT(ROW(1:1)/10)+2)
In Sheet1!D13 this references Sheet2!B3.
The OFFSET function can accomplish the same thing but it is a volatile function that recalculates whenever anything in the workbook changes. INDEX provides the same functionality while remaining non-volatile and will only recalculate when something that affects its returned value changes.