Excel 2010 :: Macro Or VBA Code To Rearrange Data

Jul 5, 2012

I'm using Excel 2010 and XP. I have data in rows 1 -4 that can not be altered. There are headings in Row 5, B-L & Row 6, F-J.

Data starts in Row 7 and follows the headings. This repeats for several thousand rows. I need a way to move Row 6, F-J and put it on Row 5, M-Q

Row 6, F-J and put it on Row 5, M-Q
Row 8, F-J and put it on Row 7, M-Q
Row 10, F-J and put it on Row 9, M-Q
Row 12, F-J and put it on Row 11, M-Q
....
....
....

Then delete blank rows below Row 5

View 7 Replies


ADVERTISEMENT

Excel 2010 :: Macro To Pull AP Within Specific Zip Code?

Jun 15, 2012

I have an excel 2010 spreadsheet that lists all of our vendors and the amount we spent with them over the last year.

I want to know how many of them were local vendors.

I have a list of all the zip codes within a 100 mile radius (there are about 500 zip codes). I would like to write a macro or sort function that searches the entire vendor list and only reports back those vendors that are included in the zip codes I specify.

The columns are as follows:

A B C D E
Vendor City StateZip CodeTotal AP
Vendor 1TROY AL36082527.37
Vendor 2PHOENIXAZ85054100
Vendor 3TUCSONAZ8571416255

I want to keep the all the columns, I just want to eliminate all of the vendors that do not fall within the zip code criteria I set.

View 5 Replies View Related

Macro To Rearrange Data

Dec 6, 2007

I need to write a macro which rearranges my data for me. The data looks like this;

Data______________Unit_____Jan06_____Feb06_____Mar06___(etc)
Coal consumption___tonnes
Coal energy________GJ
Electricity__________Mwh
Production_________tonnes
etc

This macro will need to be applied to a number of sheets with different time periods and different types of "Data". What I want to do is write a macro that will transform the data to look like this (where xxx is the data entries);

Coal consumption___xxxx____tonnes___Jan06
Coal consumption___xxxx____tonnes___Feb06
Coal consumption___xxxx____tonnes___Mar06
Coal energy________xxxx______GJ____Jan06
Coal energy________xxxx______GJ____Feb06
Coal energy________xxxx______GJ____Mar06
etc.

So that I can easily import it into access. I know basically how to do it, but I can't automate it to apply to a sheet with any stretch of data fields or types of data.

View 9 Replies View Related

Excel 2010 :: Add Code To A Macro To Calculate Something Depending On Months

Aug 22, 2012

I am looking for something to calculate values based on the past three months. I already have written a macro to retrieve all of the data and just need this as an add-on.

for example, lets say it is 5/31/2012. I have a row with dates going like

10/31/2010 11/31/2010 .........

I want the formula to calculate SUM(march+april+may row 68)/SUM(march+april+may row 59)

I have an input tab where I can select the month, say 5, and get the periods.

3/31/2012, 4/31/2012, 5/31/2012

if I changed the 5 to an 8 it would get 6/31/2012 7/31/2012 8/31/2012

I don't know if i need VBA for this but I am trying to have something to calculate this depending on the period selected in the input tab.

I am using excel 2010. I am thinking something with an offset function and maybe a loop? but still not sure.

View 2 Replies View Related

Using A Macro To Extract And Rearrange Data?

Sep 6, 2009

I have a big collection of spreadsheets that are all laid out in the same fashion: from A2 down are the names of different individuals (one name per row). Column titles (from B1 right) are the names of unique qualifications that these individuals possess. In the cell where a row and column intersects is the date at which this qualification was awarded. If this doesn’t make total sense, I’ve attached a very basic version of this to the post (Sheet 1) – although the spreadsheets I’m working with have hundreds of individuals and scores of qualifications, rather than just a couple!

This data needs exporting/rearranging into a format that’s recognisable by another piece of software that we use. In this format, the data is split into three columns: the person’s name, a possessed qualification and the date it was awarded. This means that a single individual’s name may have multiple rows, since a different qualification will be present in each row for that person. An example of this layout is shown on Sheet 2 of the attachment.

View 2 Replies View Related

Excel 2010 :: VBA Code To Extend Formula To (End Of Data)

Mar 4, 2014

I created the following macro (using the recorder), and now need to modify it so that the formula extends to the end of the data (and no further). I would also like to include a total at the end.

Sub ExcessUsage2()
' ExcessUsage2 Macro
Rows("39:250").Select
With Selection.Font
.Size = 8
.Strikethrough = False

[Code0 ....

View 8 Replies View Related

Excel 2010 :: Macro To Color Code Cells Based On Value In A Cell And Range In A Table

Dec 2, 2013

I am using Windows 7 and Excel 2010.

Is there a way to create a macro to color code a cell based on the value in a cell, and then look up a value in a table, then color code it based on where it fits into the table?

I have a table of values for about 30 projects. In column g - there is a CPI value (see bold column)

Example: Project ID
Name
Program
PMT
SI ID
AC
Milestone
TCP Level
[Code] ......

Here is the table:

I have to color code a cell, base on the CPI and how it fits into the table below. So if the current Milestone is M2 or M3 and the CPI calculated is .14 the cell would be colored RED, if the CPI number is 2.01 for M2-M3 I would want cell to be colored Turquiose. If we were at Milestone M6 and the CPI was 2.01, it would be colored blue. If the CPI was .75 at Milestone M5, it would be colored Green

LEGEND
Earned Value Limits

Milestone
RED
Yellow
Green
Turquoise
Blue

M2-M3
2.15

M4-M6
1.66

M7-M11
1.26

View 2 Replies View Related

Excel 2010 :: Combobox Or Data Validation With Macro

Apr 9, 2013

I am using excel 2010. I have 3 separate form control each with its own macro. I would like to create a combo box with a drop down with a list of each form control case and be able to perform the same function as the individual form control when a specific name is chosen in the list of the combo box.

View 3 Replies View Related

Excel 2010 :: VBA To Start Macro When Changing Data In A Cell

Jul 21, 2014

When a change is made in cell L11, cell N11 should be locked automatically for typing. This is true for the cells between L11:L25, and cells N11:N25.

I have been trying to come up with a code that will:

1 - start my macro when f.ex. L11 is > 0
2 - lock N11 when L11 is filled out
3 - unlock N11 when the input in L11 is deleted

This is my attempt so far to put together a code:

[Code] .....

I'm using Excel 2010.

View 1 Replies View Related

Excel 2010 :: Macro - Move Data From Rows To Columns

Dec 13, 2011

I am using Excel 2010 and need a macro that can convert data from rows to columns. I have read several posts about this subject but have no experience with macros and don't know how to change the macros to fit my scenario.

Here is what I currently have:

Account...Vehicle1...Loc1...Vehicle2...Loc2...Vehicle3...Loc3...Vehicle4...Loc4
11111......2008........FL
11111......2000........FL
12121......1999........GA
33222......2000........AL
33222......2011........AL
33222......2001........MS

Here is what I need it to look like:

Account...Vehicle1...Loc1...Vehicle2...Loc2...Vehicle3...Loc3...Vehicle4...Loc4
11111......2008.......FL.......2000........FL
12121......1999.......GA
33222......2000.......AL.......2011........AL......2001.......MS

There are up to 4 vehicles/locations per account number, and I need 1 account number per row (the dots above are for spacing only and not part of the actual data).

I could do this manually but because I have so many rows of data it could take days or weeks. Is there a macro out there that can do this??

View 3 Replies View Related

Excel 2010 :: VBA Code To Extract HTML Source Code Not Working On Google Sites

Dec 6, 2012

I have previously used the following code to successfully pull out IE webpage source code for string manipulation.

Its a crude example to demonstrate the principle:

Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public IE As Object
Sub Sample()
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

[Code] ......

However when I substitute in a Google websites address into the IE.Navigate command, the code runs to the "Source_Code = IE.document ...." line then flags up a Microsoft Visual Basic error. "Run-time error '438': Object doesn't support this property or method"

The webpage that I am trying to access is a confidential company site, so you won't be able to access it yourself, but starts with [URL] ......

The one thing that I have noticed about this website is the Privacy Report icon in the lower right status window (Picture of an eye with a restricted symbol in front). I don't know whether this is the cause of my problem, or purely an incidental observation.

Is there something peculiar with Google sites that means that the source code cannot be extracted in general, or is this an issue specific to my site ? Does the Privacy Report icon have any relevance, and if so how do I switch that off ?

Using :
MS Excel 2010
IE Explorer 8.0

View 1 Replies View Related

Excel 2010 :: Macro Based Search Function Using Data From 2 Cells

Mar 15, 2012

I have been using a macro to search and highlight customer addresses for me, however I have changed my worksheet and now have the addresses in two columns instead of one (D for the numbers, E for street names) for sorting purposes.

What I would like to do is either; find a way to search using data from 2 cells to get a result, or have multiple results highlight and popup.

Using: Excel 2010

Code:
Sub SEARCH_FUNCTION()
Set FoundCell = Sheets("Route").Cells.find(What:=Sheets("Intro").Range("G15"), LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
If Not FoundCell Is Nothing Then
With FoundCell

[Code] ...........

View 2 Replies View Related

Excel 2010 :: Macro To Delete Last Line Of Data In Each Worksheet In Workbook?

Apr 24, 2014

I'm trying to create a macro that will look at each worksheet in a workbook and then delete the last line of data on each worksheet. The last row can vary on each worksheet. This is what I have come up with but it is not working. I am on Excel 2010 and Windows 7.

Sub Macro1()
Macro1 Macro
Dim ws As Worksheet

[Code]....

View 2 Replies View Related

Rearrange The Order Tabs Display In Through VBA Code?

Jun 28, 2007

Is there any way to rearrange the order tabs display in through VBA Code?

View 9 Replies View Related

Excel 2010 :: Getting Outlook Warning (2010) While Sending Email Through Macro

Mar 25, 2014

I am trying to send bulk emails from my excel 2010 - however I am getting a POP UP. find the screen shot in the enclosed word document So every time a new mail is sent from excel we need to press the button allow Is there a way where I can turn off this warning.

View 6 Replies View Related

Rearrange Sheets Name By Using Macro?

Mar 13, 2014

I used this code to sort sheets,

Code:
Sub Sort_Active_Book()
Dim i As Integer
Dim j As Integer
Dim iAnswer As VbMsgBoxResult
iAnswer = MsgBox("Sort Sheets in Ascending Order?" & Chr(10) _
& "Clicking No will sort in Descending Order", _
vbYesNoCancel + vbQuestion + vbDefaultButton1, "Sort Worksheets")

[code].....

now if my sheets name is like this 001_Tommy, 002_Alex, 003_John, 004_Daniel, 005_Alan,......., and I want to sort sheets name after the underscore "_", arranged like this, 005_Alan, 002_Alex, 004_Daniel, 003_John, 001_Tommy,......, how to do this?

View 2 Replies View Related

Excel 2010 :: VBA Code To Open Save As Box In Specified Folder

Apr 24, 2014

I have windows 7 and excel 2010 and am using a macro that opens up a csv file(I think) of daily reports into Excel and then automatically delineates it and formats it how I want it. I will be using this to save a new file every day for the reports from the previous day and want to include at the end of that macro a way to prompt the user to "save as" so that each day they can run the macro and enter in the date and save that report for further use. I am wondering what VBA code I could use at the end of the macro code to prompt the Save As box and if I could already have the save us set up in the following folder... "W:Daily to Fortis Excel2014(the user will put in the date here)".

I've been looking around sites and trying to figure it out. I need the file format to be the same as when you save as "Excel Workbook". I was trying to use the Saveas (filename) function and could get it to save every time as a specific file name in that location but when I run it the next day it has the same name and saves over itself. So I need the user to be able to put in todays date as the filename to create a new one every day.

View 7 Replies View Related

Excel 2010 :: Update Time In A1 Timer VBA Code

Jun 2, 2014

The only change I made was to change the "Sheet1" to "Journal" to match the worksheet name in my workbook.

As you close and reopen the workbook, the timer should start with =NOW() in A1 (formatted as "HH:MM:SS") and count up with the current time until you close the workbook.

I use Excel 2010, could that be the problem, that I copied a VBA code for an older version of Excel???

Question: What exactly is a regular module, do I use Module 1 for the first portion of the code or place it in ThisWorkbook?

AUTO TIME UPDATE VBA

PLACE IN REGULAR MODULE

[Code] ....

View 7 Replies View Related

Excel 2010 :: Condensing VBA Code - Using Dynamic Variables?

Jul 17, 2012

I have some VBA that dumps various sheets data into an SQL Database.

Part of that requires me to sanitize all of the fields before they make it to the DB, (at least to prevent the code from breaking itself w/ errant ' characters.

right now my code is as follows

Code:
If InStr(aa, "'") > 0 Then
aa = Replace(aa, "'", "''")
End If
If InStr(bb, "'") > 0 Then
bb = Replace(bb, "'", "''")

[Code] ......

I was hoping to condense it to something like the following, however it is not working how I hoped / want it to. .. I had found somewhere out there that this Eval() function possibly could be used to 'reference' dynamic variables, however it does not appear to work at all anymore, and even then it may only have worked to 'read' and not 'write' to the variable. (Excel 2010, on Windows 7 64-bit).

Code:
itemsToSanitize = "aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt,uu,vv,ww,xx,yy,zz,aaa,bbb,ccc,ddd,eee,fff,ggg,hhh"
ITSArray = Split(itemsToSanitize, ",")

For Each thing In ITSArray
If InStr(Eval(thing), "'") > 0 Then
Eval(thing) = Replace(Eval(thing), "'", "''")
End If
Next thing

View 7 Replies View Related

Excel 2010 :: Code / Button To Automate Certain Row Heights

Dec 6, 2012

Code + Button to automate certain row heights.

1. Starting in row 5 the row height is to "30"...every 17 rows after row5 to have a height "30"...next row 22 is "30" , then row 39 is "30" and so on...
2. All rows in between row height "30" will be with a row height of "11"
3. Can this be associated with a button....
4. where would i place this code.....

Version:Excel 2010

View 9 Replies View Related

Excel 2010 :: Code For Inserting And Removing Dates

Dec 14, 2012

I need a code that when i place a date in a cell D10 (Example:25-January-2013) it will then add 40 days of dates daily to AP10.In D9 can it also add the weeknumber (every 7 days the weeknumber increases by 1) corresponding to the day date in D10 (iso).Can this be attached to a button.Enter the date in D10 then press the button and the dates auto insert across the sheet daily to AP10.

Can the button say ADD DATE or REMOVE DATES.First date in D10.When the button says REMOVE dates all dates deleted when button pressed and cell D10 then says "add date here".If no date is placed in D10 and ADD DATE button is pressed a warning messagebox appears and says NEED TO ADD DATE .Will not work until date entered.When date entered in D10 "Add Date Here" disappears until REMOVE Date button is selected and again "Add Date Here" is displayed....not sure if this is possible but would be good if achieved. Excel 2010

View 3 Replies View Related

Excel 2010 :: VBA Code To Highlight Color Through Columns

Jan 8, 2013

As seen below, I'm looking for a vba code to highlight color on every Friday and through columns 1, 4, 6,9,11,14,16,19,21 upto columns 28 i.e. AH

Excel 2010ABCDEFGHIJKLMN1DateQty1Qty2TotalDateQty1Qty2TotalDateQty1Qty2Total
21-Aug-124559289374521-Aug-122721298357041-Aug-1222792338461732-Aug-121161244636072-Aug-12347918036592-
Aug-1225723358593043-Aug-12128088221623-Aug-124369158259513-Aug-1227723299607154-Aug-124096192960254-
Aug-124679386585444-Aug-122081870295165-Aug-12333751838555-Aug-124270357278425-Aug-1231793455663476-
Aug-122061336654276-Aug-1241466142076-Aug-123761939231587-Aug-123757375975167-Aug-12212203622487-

[Code] .........

View 2 Replies View Related

Excel 2010 :: VBA - Run Code Only When Clicking In Specific Cell?

Dec 23, 2013

how to run some VBA code (written by someone else, unfortunately) only when clicking once in cell A1, and not run in any other cell. This is being run in Excel 2010. The code I would like to run in this manner is below, and currently will run when the user clicks on any cell in the worksheet it is applied.

[
Option Explicit_________________________________________
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'If IsDate(Target.Cells(1, 1).Value) Then
Set DatePickerForm.Target = Target.Cells(1, 1)
DatePickerForm.Show vbModal
Cancel = True
'End If
End Sub
]

View 3 Replies View Related

Excel 2010 :: VBA Code That Will Hide / Unhide A Row When Used With Checkbox

Jun 22, 2014

I need a VBA code that will when used with a Form Control "Check Box" will unhide / hide a row. To be more exact, I'm needind the code to "Hide" row 34 when unchecked and "Unhide" the same row when checked. I'm using Excel 2010.

View 9 Replies View Related

Rearrange The Data

Jan 1, 2010

I've the data like this

Item 1,Item 2,Item 3
Product 1a,Product 1b,Product 1c
Product 2a,Product 2b,Product 2c

And I want to rearrange like this
Product 1a
Product 1b
Product 1c
Product 2a
Product 2b
Product 2c
Product 3a

View 9 Replies View Related

A Macro With Message Box To Rearrange Text In A Cell

May 13, 2009

Is there a quick Macro I could use to rearrange text in a cell. For example our organisation list all the departments in an unconsistant way and it makes finding the departments hard using A-Z. For example some department will say "Department of ...", "Dept of ...", Division of ..." or "Div of ...". (Obviously excluding the quotes).

What I wanted to know is this. If you highlight the range you wish to work with, could you use a message box to ask you what text you wish to edit and then automatically search the range and make the changes.

For example search for "Dept of " (note I would need to keep the space after of otherwise I would have leading spaces) so that "Dept of ABC" becomes: "ABC, Dept of" and say "Division of XYZ" becomes "XYZ, Division of"

View 4 Replies View Related

Excel 2007 :: VBA Code Doesn't Work In Outlook 2010

Jun 23, 2014

My company recently upgraded everyone to Microsoft 2010 from 2007 version. I have no substantial VBA skill and left with a VBA code which is supposed to extract a list of outlook emails sitting in a shared mailbox into Excel.

I was using that VBA code in Outlook 2007 and it worked fine but shows the following error when run in Outlook 2010: 'Run-time error '-2147221233 (8004010f)': The attempted operation failed. An object could not be found. Here is part of the code:

[Code] .....

It worked after one of the members suggested to "click on any line of this code and press F8 repeatedly until the yellow focus moves to the error line, don't press F8 anymore. Now in immediate window, copy paste each of below lines, press enter after each line. Let us know where the error occur." However, it stop working the next day.

? olNS.Folders("Mailbox - Market Intelligence").Folders.Count
? olNS.Folders("Mailbox - Market Intelligence").Folders("Inbox").Items.Count
? olNS.Folders("Mailbox - Market Intelligence").Folders("Inbox").Folders("MI").Items.Count

View 2 Replies View Related

Excel 2010 :: Code To Extract Unique List Of Dependents?

May 31, 2012

Excel 2010ABCDEFGH1EMPLeaderSamAsbertNoellaJackson2RosalineSam3LionelAsbert4KerryNoella5JohnnyNoella
6AliAsbert7RosalineSam8TimothyAsbert9TimothySam10ReginaldAsbert11PascualJackson12MichaelSam13ReginaldJackson
14MeganJackson15ShellySam16CandiceSam171819Sheet1

Here's my problem... Column A contains employee name & column B contains Team Leader name of the respective employee. Range D1:G1 should contain names of team leaders from column B. After that, depending on the name populated in D1, cells going downwards from cell D2 should contain name of employees of that team leader. Similar thing should be repeated for columns E, F, & G. If an employee shows up under two team leaders then it should be displayed under both lists.

Is there any formula/VBA code which can do this? Been after this for last 3-4 hours and now just lost in a maze of various Index Match combinations and array formulas..

View 9 Replies View Related

Excel 2010 :: VBA Code To Search A Table And Return Value Of A Match

Oct 5, 2012

I have sheet 1 that in cells V5:V20 is a data validation drop down box. In cells W5:W20 I have another data validation drop down box. On sheet 2 I have a table that in column A matches the data in the drop down box's in column V on sheet 1. Row 1 on sheet 2 data matches the data in the drop down boxes in sheet 1 cells W5:W20. What I'd like to do is on sheet 1 Cells Y5:Y20 have a VBA code to lookup the data in columns V and W from sheet 2 and return the value.

Windows 7
Excel 2010

View 9 Replies View Related

Excel 2010 :: VBA Code To Connect To SQL And Pull Records To New Worksheet

Oct 18, 2012

i found this code...

Code:
Sub Button1_Click()
Dim cnt As ADODB.Connection
Dim rst As ADODB.Recordset
Dim stSQL As String
Dim SNfound As String
'Your sqlserver 2008 connection string
Const stADO As String = "Provider=SQLOLEDB.1;" & _
"" & _

[code].....

but i dont see where to put in the Database object...

The Database it needs to connect to in SQl is called

The Server name is SQLSRV when you expand databases the database is called SWHSystem the Table is called dbo.Credential and from that i need to get SELECT All from the Name and CardNumber from dbo.Credential and put that in a New Sheet titled Personal

using Excel 2010 connecting to SQL 2008

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved