Copyfromrecordset - Dates Pasted As Values

Apr 20, 2007

If I use the code below to retrieve a recordset from SQL Server and the drop it into the activeworkbook, using CopyFromRecordset and a sheet where I have just deleted all the columns - thus leaving a default sheet (I think)....everything works fine

'Drop in field name and data
counter = 1
For Each fld In SQLRS.Fields
Sheet1.Cells(1, counter) = fld.Name
counter = counter + 1
Next

Sheet1.Range("A2").CopyFromRecordset SQLRS

However, if I change it to paste into a brand new work book as in the code below....all the dates are pasted in as Integers...

'Create new book and sheet
Set NewBook = Application.Workbooks.Add
Set NewSheet = NewBook.Worksheets.Add
NewSheet.Name = "Sanofi Renewals"

I've used this same process previously and not had any problems what so ever when dates where pasted....

View 5 Replies


ADVERTISEMENT

CopyFromRecordset Object Range Failed

Apr 2, 2005

When I try to pull some records from Oracle into Excel using ADO, I recieved this error msg:

Run-time error '-2147467259 (80004005)':
Method 'CopyFromRecordset' of object ' Range' failed

And here's the code I'm using:

Dim c As ADODB.Connection
Dim r As ADODB.Recordset
Dim sq As String
Set c = New ADODB.Connection

It's the standard ADO example used in this forum many times. Obviously there is some type of issue when the records are returned. I know that it isn't an issue with the number of records returned. It can return 30,000 fine but a few hundred may return this error. It's kinda random.

View 9 Replies View Related

VBA To Execute When Data Values Copied / Pasted Into Range Of Cells

Jan 27, 2014

Below is code I have attempted. I am learning VBA and have gathered this code from the internet and this forum. I have data that is in columns B to E and from row 7 down. I want this VBA code to run when data is copied/pasted in these cells. Where the last values stop will vary so I just want to be sure this code is executed after all the data is pasted in these cells. The data will be pasted at one time. When the user removes the data from these cells, I do not want the code to run.

Private Sub Worksheet_Change(ByVal Target As Range)
'Do nothing if less than four cells are changed or content deleted
If Target.Cells.Count < 4 Or IsEmpty(Target) Then Exit Sub

[Code].....

View 1 Replies View Related

Sorting Pasted Data By Recognizing Data As Dates

Oct 26, 2013

I copy/paste the data from this website [URL] ........

How I can sort all the data based upon the "Date"? The date data is not recognized when I copy/paste.

View 1 Replies View Related

Adding Values Between Two Dates And Dates Are Also Derived By Formula?

Dec 9, 2013

I have attached an excel sheet for your reference. I have particular debit values that are to be added between the dates. And Dates are also derived by formula based of payment term.

The ones I need to modify is Highlighted in Yellow. The values to be added is in "Customer Statement" and in H Column

These dates also have formula by which there are derived

-------------------------Current Ageing-------------------------
Date Range

Bucket
Amount
Percent
Start Date
End Date[code].....

I am USing =SUMIFS('Customer Statement'!$A:$A,'Customer Statement'!$H:$H,"=" & E11) but does not work.

View 9 Replies View Related

Parsing Pasted Data

Oct 13, 2008

macro that will parse data that has been pasted in to Excel from a text document. Once the macro is executed the pasted data will be sent to a separate spreadsheet and parsed horizontally with the data residing in is respective cell.

Here is an example of my data from text:
FIRST: Frank
MIDDLE: N.
LAST: Stien
ADDRESS: APT14
STREET: Halloween
ZIP CODE: 123456
CITY: Scaryville
STATE: Scary Ya
COUNTRY: Transilvania
COMMENT: N/A

Here is an example of my desired results:
A2:Frank, B2:N, C2:Stien, D2:APT14, E2:Halloween, F2:123456, G2:Scaryville, H2:ScaryYa, I2: Transilvania, J2:N/A

The data is always pasted in A2 on the first sheet, and varies somewhat in length but the format is always the same.

View 5 Replies View Related

WorkSheet Pasted Into Outlook

Jul 31, 2009

I am having trouble figuring out how to paste an Excel Worksheet into Outlook. I am using '07 versions for both. I currently have code that when a button is selected, Outlook opens and has form text that I have entered. I just cant figure out how to get the worksheet pasted into the body of the email after this text. Here is what I have:

View 3 Replies View Related

How To Move A Pasted Shape

Mar 2, 2013

I Have several images on Sheet 1, I can copy the needed Images to sheet 2 as needed.

Once the image is pasted to sheet2 how do I assign it to a shape variable so that I can position it as desired.

I do not want to have to use Sheet2.(Range("B2").activate or similar

I'm looking to use

Shp.top = 25
Shp.left =15

Code:

Sub Macro1()
Dim Shp As Shape
Sheet1.Shapes("Picture 1").Copy
Sheet2.Paste

'To set the shape variable to the shape on sheet2

Set Shp = "WHAT GOES HERE"
Shp.Top = 25
Shp.Left = 15
End Sub

View 4 Replies View Related

Naming Pasted Range

Mar 26, 2008

After pasting a Range and while the Range is still selected, I would like to Name it. May I have some assistance with the proper statement?

View 9 Replies View Related

Pasted Time Changing 00:00:00:000 To 00:00.0

Aug 23, 2007

I am trying to enter 00:00:00.031, but it is changing it to 00:00.0. Can someone please tell me how to stop it from doing that?

View 9 Replies View Related

Sum Values In Column That Correspond To Column Of Dates Between Two Specific Dates?

Jun 25, 2012

What I am trying to do is sum values for each day of the month up to a designated date.

Example:

A1=any date of the month

A2-A31 = 6/1/2012-6/30/2012
B2-B31 = values that correspond to each date

how can i sum the values in column B from the beginning of the month to A1?

View 3 Replies View Related

VB Script To Arrange Pasted Data

May 11, 2014

I am starting a data sheet that I will be pasting from the internet into my data sheet daily, the problem I have is that the content data is pasting with blank rows between data and also there is one piece of data that is situated on the row below which i need moving to the end of the main data row, the idea is to have single data rows with no blank rows.

I have attached an example sheet showing the layout it repeats with only the amount of data that changes.

I have colored the data as follows:

Grey= Blank Rows
Yellow= Data Move to end of main row
Green= Unwanted Data

View 5 Replies View Related

How To Prevent Duplicate Data Being Pasted

Jan 14, 2013

I have a worksheet that you can enter in

Forename, Surname, Area, D.O.B

This has a macro assigned that copies the data and pastes it into another worksheet at the next available row.

Now this works fine, but I want to be able to identify if the data already exists in the other worksheet then prevent it from being pasted and give an error message that the person already exists in the database.

Is this possible?

View 8 Replies View Related

Sort Pasted Data Into Specific Columns

Jul 2, 2014

how to sort data pasted from word into specific columns e.g.

I paste: 1,2,3,4,8 into the ref row, and it poulates as such, leaving out the columns for which there is no corresponding value:

Competency: 1------2--------3-------4------5------6------7------8
Ref: -------WR1----WR1----WR1-----------WR5------------------WR1

View 2 Replies View Related

Converting Pdf Cut And Pasted Data Into Separate Cells

Jan 26, 2009

I have rxd a pdf file that I need to manipulate I have copied the data into excel and now need it in individual cells:? The data looks like this: 02392950067 19/12/2008 14:33:35 02392950053 Portsmouth 1.9 £0.03. this is:

phone number calling | date called | time called | number called | duration in minutes | cost of call. If you're out there I'd be more than happy to hear from you. the cells to cut the data into will be formatted to take the data in the correct form. 02392950067 19/12/2008 14:33:35 02392950053 Portsmouth 1.9 £0.03
phone number calling | date called | time called | number called | duration in minutes | cost of call.

View 3 Replies View Related

Recognizing Data Copied And Pasted From Internet?

Sep 15, 2013

Whenever I copy and paste dates from the internet I can't get Excel to recognize the info as dates, thus making it impossible to sort by date. It doesn't matter which site I use, I have the problem with all of them.

[URL]

Using any of the links above, how I can paste those dates and get Excel to sort the date?

View 1 Replies View Related

Number Format Not Applied To Pasted Data?

Jan 5, 2014

I have a thoroughly outdated system to keep a log of call centre stats. In order to facilitate a marginally easier workflow, I have rearranged a few things so that a user simply has to copy and paste data from reports into the worksheet.

The worksheet is set up with all the number formats like time and percentage which are extremely important in totaling and averaging hours and availabilities, however the pasted data doesn't match the destination format and it therefore affects the total.

I have tried many different special pasting options to no avail.

The only way i seem to be able to do it is to go into each line and retype my percentages (as 100 becomes 10000% ) and click the tick next to the formula bar so 00:00:16 is calculated as a quantity of time instead of text. With 30 people and 15 stats each day that exercise becomes a little bit tedious and counterproductive.

View 9 Replies View Related

Input Box Info Pasted Into Range Of Cells

May 29, 2009

I have this code going for a sheet i've been working on, but thers only one thing I can't figure out how to do.

I want it to take the text that was entered in the "Grid Date" input box and stick it in the bottom 10 cells (plus one space). IE - if A14 is the last used cell, paste it into A16 through A26.

View 2 Replies View Related

Get Data From Excel Chart That Was Pasted Into PowerPoint

Oct 6, 2013

I have a powerpoint presentation which has a bunch of Excel charts embedded as Microsoft Office Graphic Objects, but I don't have access to the source data (plus the links are broken).

how to get the underlying data. I vaguely recall once doing this with some vba that I had found somewhere the net, but I don't have the code anymore.

I have some code that works within Excel however:

Code:
Sub GetChartValues()
' this macro will recover the data from a disconnected Microsoft Graphic Object (such as we used to paste
' into PowerPoint). You will need to insert a Worksheet entitled "ChartData" to store the values.
Dim NumberOfRows As Integer

[code].....

how to make this code work in PowerPoint?

View 4 Replies View Related

Automating Entries In Column Adjacent To Pasted Selection

Jul 17, 2013

The following code inserts the text "ep" into col. F when an entry (formatted text colour green) is made in the corresponding row of col. B:

VB:

Private Sub Worksheet_Change(ByVal target As Range)
' Insert "ep" in Type column and set font colour
If target.Column = 2 And target.Font.ColorIndex = 10 Then
With Cells(target.Row, "E")
.Value = "ep"

[Code]...

However, more often than not new entries are made by pasting from another sheet, and usually more than one row. How can the code be modified to count the number of rows in the pasted selection and place "ep" in each corresponding row of col. F (instead of just the top row)?

I've been trying Selection.Rows.Count but keep getting the dreaded error message, "Object doesn't support this property or method".

View 6 Replies View Related

Data Validation To Work When A Duplicate Value Is Pasted Into A Column

Feb 10, 2009

I have to enter patient's SSN's into my database. The fastest and most error free way to do this is simply copy the SSN from the electronic chart and paste into the appropriate cell in the database. I don't want duplicates. So, I need the database to alert me when I paste in a duplicate SSN. I know you can set data validation to do prohibit duplicates by using a formula. In the attached spreadsheet the SSN is in column B, so:

View 3 Replies View Related

Format: Figures Donot Match Even Pasted As Value 2007

Jul 2, 2009

i have put a small extract from list of 50000 values. I have Figures which are pasted as values on top and on A column but they do not agree unless i F2+enter on each figure on Column A that would mean 50000+ enteries.. i have tried copying column A and row 1 and pasting it as value but still no change. Row 1 header figures are typed manually.

View 2 Replies View Related

Data To Be Ranked Groupwise And Then TOP 5 Of Each Group To Be Pasted In Other Sheet

Apr 27, 2008

I have a data in which I need to do a GROUPWISE RANKING and then to find Top 5 of Each group, which is to be pasted in next sheet.

View 14 Replies View Related

Validating Cell Formulas Previously Pasted As Text

Nov 5, 2009

I have generated a matrix in excel through iteration (I'm trying to calculate a dinamic covariance matrix between 50 values) which looks like this:.......

A 50x50 matrix. What I have generated in each cell is not the formula, but the text of the formula. Somehow Excel has a valid formula in a specific cell, but "doesn't know yet" that within the cell there is no longer a text. So, to make every formula run, I have to go cell by cell pressing F2, then enter, 2.500 times. Notice that in each formula I don't have something like this:

+"+COVAR(Rends!C4:AB4;Rends!C4:AB4)" or
'+COVAR(Rends!C4:AB4;Rends!C4:AB4)

but the valid formula: +COVAR(Rends!C4:AB4;Rends!C4:AB4)

View 2 Replies View Related

Aligning Pasted-in Data To Match Blank Rows

Nov 10, 2011

I have a set of 50 or so large worksheets that need updating each month. My problem is the figures I need to update these sheets with are formatted differently (different alignment of blank rows) to the destination.

I'll try to illustrate, this is the sheet I need to add data to on a monthly basis... (you'll need to imagine the numbers in column form as I'm no HTML expert)

May June July
23 34 45
65 34 45
34 23 23

[Code] .......

The blank rows need to remain uniform. When I need to paste in August's data the blank rows in the raw data extract are aligned differently and it's a laborious job deleting and inserting cells to get them to align (the sheet has hundreds of rows).

I'm capable enough of recording a macro to replicate the delting/inserting of cells BUT of the 50 or so sheets I need to update there's no uniformity of where the blank rows occur. To further exacerbate, there's no uniformity over where the blank rows occur in the data that needs to be pasted in, either. The blank rows already in the worksheets HAVE to remain and can't be deleted or altered.

View 9 Replies View Related

Excel 2010 :: Maintain Pasted Chart Format

Oct 23, 2012

Using 2010 - When I paste a chart I can initially retain the format of chart bar colours (Paste Special - source formatting). But when I select a new data source for the chart the formatting of the colours is not retained.

View 1 Replies View Related

Worksheet Format Macro Not Affecting Pasted Data

Mar 31, 2007

I'm currently using some pretty extensive conditional formatting macros on a worksheet (this functionality is working fine when data is directly entered into the sheet). But when i paste data from another worksheet into my "formatted" sheet, the formatting does not take affect. is there any way to "refresh" a macro?

View 2 Replies View Related

Macro And Conditional Formatting: Formats The Data That Is Pasted Into It From An Access Database

Dec 2, 2008

The macro firstly formats the data that is pasted into it from an access database, then it does some calculations to determine when 10 working days from a specific date is, and when 20 working days from the date is (these go in new columns at the end of the data). The macro will also add new columns which say "Not resolved" if there is no date in the Resolution column, "Yes" in the "10 working days met?" column if the condition is met and the same for 20 workings days in a different column. As the colouring etc takes a long time I really wanted to add as conditional formatting to the macro!

how to attach a spreadsheet here then I can show you what the outcome we want is. A point to note is that there is not a set number of rows each time we do this, and I don't just want 1 cell to be coloured - I want to specify which cells in the row are coloured depending on the results in another cell on that row.

View 2 Replies View Related

Mailing Address Pasted From Internet To Excel And Then Mail Merge With Word?

Jul 26, 2013

I'm trying to use Word mail merge with Excel to create mail labels and letters for each person on the list. For example,

Johnson, Michael
7391 Wilson Street
Van Nuys, CA 91405

I want to create a mailing label for this person. If possible, I'd like to make the top line of the address "Dr. Michael Johnson," however the format that I'm copying from is last name, first name. And I also want to want to create a letter that starts with "Dear Dr. Last name," such as "Dear Dr. Johnson." This is the website that I want to copy the addresses from:

Doctors in Los Angeles, CA | Primary Care Physicians and Specialists

I have done my homework, but I don't know how to properly paste the addresses into Excel and then use Word to create the labels and letter. I have tried many ways, but I have been unsuccessful.

View 1 Replies View Related

Sum Values Between 2 Dates

Oct 5, 2007

I'm trying to sum one column (E) if another column (C) meets the criteria of being between two dates (4/10/07 & 14/10/07)

I've looked all through the questions on line but can't get any of the examples to work for me..

View 3 Replies View Related







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