VB For Selecting Date Then Copying Next 14 Columns To Another Workbook?

Jul 17, 2014

I have an employee schedule that is a whole year. I'm trying to extract only the next two weeks worth of columns. I'll schedule it to run once a day. Some information... The calender has the dates listed in Row 2 on Sheet called Daily Schedule The 2 week calendar would be on sheet 7 called Two Week Calendar There are only weekdays on sheet 1 Daily Schedule so if there is nothing matching today's date just stop and do nothing I would like it to save the whole file when complete

I have written some of the simplest code but I don't know how to select by today's date then copy that column plus 9 to the right.

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Open("C:Schedule.xlsx")

[Code]....

View 2 Replies


ADVERTISEMENT

Selecting Specific Columns From Multiple Workbook

Dec 13, 2008

I have a worksheet which is used by multiple users at the same time, at the end of the day I can have upto 10 files. The layout of all the files is the same, same number of columns and rows, the only difference would be the file name eg:Test1.xls, Test2.xls etc. information in test1.xls will not be any other file. At the end of the day, these files are emailed and saved in a particular folder.

What I need is get information from all the files saved in a particular folder and keep columns which have data. Additionally, if there is no data for any columns after combining the columns to display an alert. The final file should have information with only data in individual columns and arranged in the order such as Center 1, center 2, Center 3

Eg:test1
Column A Column B Column C.....upto 30 columns
Center 1 Center 2 center 3....upto 30 centers
1 4
2
3 5

test2.xls

Column A Column B Column C.....upto 30 columns
Center 1 Center 2 Center 3.....upto 30 centers
5

The final file will look like this

Finaltest.xls
Column A Column B Column C.....upto 30 columns
1 4 4
2 5
3 5

View 9 Replies View Related

Copying Columns To New Workbook And Add Headers

Aug 26, 2013

I am trying to create a macro that will create a new workbook, copy certain columns to the new workbook and add new headersEaxample is:

In workbook 1 copy columns A To Workbook 2 Coumn D
BTo Workbook 2 Coumn F
CTo Workbook 2 Coumn O
Also add headings to the Columns in workbook 2
D=Name
F=Amount
O=Date
And last populate some columns with text all the way down tothe last row that contains text in workbook 2. A = Y
B= 5
C= Pass

View 3 Replies View Related

Copying A Date From One Workbook To Another

Mar 13, 2008

I Have a workbook with 3 worksheets in it, the Sheet named "Costomer info" has the date in cell C15 I then press a button that opens the sheet that requires the date putting in cell G7, I would like it to be automatically inserted when data is inserted to cell C10, so as soon as data is put into C10 the date is copied from C15 and put into G7

View 11 Replies View Related

Basic Macro For Copying 2 Columns From One Workbook To Another

Apr 7, 2014

I have a basic question for a macro, I've looked at other threads but they all seem to have some kind of twist to it. All I want is a macro that copies columns A&B from a source workbook to my destination workbook in a specific worksheet for column A&B too. I'm assuming that the destination worksheet will automatically update whenever the source workbook is updated? My source workbook is called Job List 7 and the worksheet is called Master Job List, my destination is Ted's Timesheet and the sheet is called Job List.

View 10 Replies View Related

Selecting All Data In Specific Columns Without Selecting Adjacent Column

Mar 10, 2014

Using VBA, I need to Select A1:C14.

The problem is that A1:C14 contains blank cells, and there is also an adjacent column D that I do not want to copy.

So, UsedRegion and CurrentRegion aren't doing it for me. (It selects Column D too.)

Obviously, this is an example...the real data set is an export and varies in size.

View 1 Replies View Related

Selecting Last Sheet And Copying From It?

Feb 11, 2013

I am trying to basically select the last sheet in a workbook, copy the contents, and paste into a new sheet which gets its name from an inputbox. I keep getting a select class error (1004).

Every month i end up adding a sheet and copying everything from the previous month, and then updating a few details which then updates my graphs. Trying to automate the process.

Here is what i have so far.

Code:
Sub Create_Report_Data()
Dim month As String
Dim wcount As Integer

[Code]....

View 2 Replies View Related

Selecting Rows For Copying Via VB Script

Jan 26, 2010

I am trying a little program to see if I could select full rows for copying. the code i use is as follows

View 5 Replies View Related

Selecting And Copying Specific Time Stamps

Dec 5, 2009

I have a output file that is collected time stamped data. How do I select the rows of the first time stamped collection. So, if the first row is stamp with 03-Jan-2009 23:59:00, I want to copy all the rows with that time stamp below the first row and stop when the time stamp starts at 03-Jan-2009 00:00:00. Attached is my sample sheet.

View 4 Replies View Related

Selecting Data From A Date Range Based On The Current Date

Jun 20, 2013

I created a basic excel weekly budget and would like to know how much money I have as of todays date. on the top row I have a date range from Sunday to Saturday, so it looks like this:

09-15 16-22 23-29

with the month manually put in above it.

then below I have income and expenses with a Overall below that, so basically what I want to is see the Overall value based on todays date, not sure how to do this with the weekly range and automatic current date(which is =TODAY() as far as I know) I have attached a photo as a reference.

Budget Picture.jpg

View 12 Replies View Related

Creating New Workbook / Copying Sheets And Saving Workbook - Subscript Error

May 30, 2014

Trying to create a new workbook from another open workbook, then copying all the sheets that aren't called "Summary" to that new open workbook and then saving it. I get a subscript error on this line:

[Code]....

View 3 Replies View Related

Copying Data From Recently Opened Workbook To Workbook Where Form Is Present

Jun 16, 2014

All i did was i just created a form to open a workbook from the directories.

Code to copy the data from that recently opened workbook to my workbook where I have my forms. I need to copy that data as in the case that i don't know the workbook and the sheet name i'am going to open as i may open any of the files!!

View 2 Replies View Related

Copying Data From Userform To Another Workbook Without Opening Second Workbook

May 16, 2014

I have created userform and it works fine. Following code assigned to 'SUBMIT' button in userform - works fine. I am trying to include code where certain data from userform is also copied to workbook2 ( of course without opening it)- as marked in red...below

[Code].....

View 4 Replies View Related

Copying EMF Object From Closed Workbook Into Open Workbook

May 27, 2014

Please see attached files.
Book1.xlsx
test.xlsm

I am trying to copy the emf image object from "Book1" into the "test" workbook whilst the test workbook is open and Book1 is closed. The code I have put together currently sort of works, I mean that it copies the text data over but does not copy the object which is what I require.

View 2 Replies View Related

Copying Rows From Workbook Containing Data To Template Workbook

Mar 6, 2014

So I basically have a template workbook that the code is stored in. I need it to pull an entire row if Column C in workbook "rawdata" contains specific text, in this case "PRCH - Purchase".I have never had to do anything like this before, it has always been working in the same workbook. It's failing at the 'mp = ...' line every time. There might be other errors in the code too, I just cannot resolve the first one!

[Code] .....

View 5 Replies View Related

Improve Coding For Copying Existing Workbook To New Workbook

Sep 18, 2006

i came up with this..

Sub Copy_To_New_Workbook()

Application. ScreenUpdating = False

Dim strFileName As String
strFileName = Application. GetOpenFilename(filefilter:="Excel Files (*.xls), *.xls", Title:="Please select the excel file to be copied")

View 9 Replies View Related

Selecting Different Workbook

Apr 26, 2006

I have a workbook called MASTER. MASTER has a macro I need to run in another workbook(wb2) I receive thru email. The problem is that wb2 can have any given name because someone else creates it.

With MASTER and wb2 (which can have any name) open, I need a macro that would select and/or make active whichever other workbook is open OTHER THAN MASTER.

View 9 Replies View Related

Selecting Columns

Sep 7, 2009

I have a table, that while writing a vba code I need to select the first column in the table (A) and the last column with data inj the table ( unknown which column it is). The last column might change (meaning that it sometimes column B, somestimes column Y etc...depends on the data). I need a way to select only the the first AND the last column in that table(actually it's the last column with data on that sheet). I'm sure there is must be a way I just don't know it!

View 2 Replies View Related

Selecting Another Workbook To Import?

Jan 3, 2013

trying to import another excel workbook with its location being flexible as the file-name will change.

This is what i got so far

Code:
Dim selectFile As String
selectFile = Application.GetOpenFilename(FileFilter:="Excel Files, *.xls*" _
, FilterIndex:=1, Title:="Open Excel file" _
, MultiSelect:=False)

[Code].....

View 9 Replies View Related

Copying Print Range From One Workbook To Another Workbook.

Jun 7, 2006

I have created a macro that copys pivot table from one Workbook to new workbook. Problems I am encountering are print selecting from source workbook are not copied to new workbook.

Dim AmountofColumns As Long, AmountofRows As Long
Dim ColumnCount As Long, RowCount As Long
Dim ThisWorkbookName As String, ActiveWorkbookName As String, ActiveSheetName As String
Public Sub CreateGroups()
Application. ScreenUpdating = False
Sheets("Preferences").Select
ThisWorkbookName = ActiveWorkbook. Name
AmountofColumns = Range("A1").End(xlToRight).Column

For ColumnCount = 2 To AmountofColumns......................

View 6 Replies View Related

Selecting Hidden Columns

Mar 19, 2009

I have a worksheet that currently has columns AB to XFB hidden. I want to unhide them, so I selected column AA and then drug the mouse over to the right (toward the empty space), intending to right-click and select "unhide". I do this all the time with no problems.

However, from the instant of my drag to the right, Excel has become totally unresponsive. I see it using 25% of my quad CPUs in task manager, but there is no active memory delta and it has been sitting for over 20 minutes now.

I'd rather not lose the work I just entered, but I can't seem to get Excel to come back to life by pressing escape or clicking in the worksheet. I've noticed slowdowns before when there is a lot of actual data in the cells selected, but these columns were empty to the best of my knowledge.

View 2 Replies View Related

VBA Selecting Workbook With Changing Dates In Name

Nov 5, 2013

I am working with two files everyday: today's and yesterday's. Each report has the day's date in the name of the file.

So I'll take today's (11-5) and import it into yesterday's (11-4). Then, tomorrow I'll take 11-6 and import into 11-5. The day after, I'll take 11-7 and import into 11-6. So on and so forth. I'm trying to figure out how I can get VBA to accommodate these changes in names. So that it sees the date in the name of today's report, sees that it is today's, then selects yesterday's (or says "Open yesterday's report!"), and imports the information.

I can figure out everything else, just not the naming issue.

I guess I could always stipulate to the person running it that they should only have these two workbooks open and that they should run the macro starting in yesterday's workbook. Just writing VBA code to select the only other workbook so VLOOKUP can be done from it. But I am trying to make it fool proof.

View 1 Replies View Related

Selecting Columns With Specific Titles?

May 26, 2014

I am looking for a way to select specific columns in excel that have specific characteristics in the header titles. For example, I have a very large worksheet with columns that specify the year and month (ie. "1900-8"). The years range from 1900 to 2011 and each year has "-1" to "-12" to represent the months of the year. Specifically, I am wanting to pick out all of the columns ending in "-8" (August).

View 14 Replies View Related

VBA For Selecting Multiple Nonadjacent Columns

Aug 8, 2009

in a vba module I currently have this

View 2 Replies View Related

VLOOKUP Selecting Multiple Columns?

Sep 11, 2012

i have the following table, i want my Vlookup not only get the description from Column K but to get column K , L , M City and Country as well and put them in Columns D for Description, E for City and F for Country. would this be possible with Vlookup formula or any other formula?

View 3 Replies View Related

Selecting Totals From UNHIDDEN Columns Only

Mar 27, 2009

I have a workbook that has 2 sheets; "Quote Summary" and "ECS". The "ECS" sheet contains columns "C" through "L" each of which has a total on row "27". At any time, one or several (but never All) of these columns may be unused and therefore hidden.

I would like to know if it is possible to sum the total of only those columns that are NOT hidden and display that value in cel "C15" of the "Quote_Summary" sheet.

View 9 Replies View Related

Selecting Range Variable In Different Worksheets Within Same Workbook

Aug 22, 2014

I want to make a range variable ("testrange") that I can use to define a range of non-continuous cells and then use that range variable to select that range of cells in different worksheets within the same workbook.

I tried the below code (simply coloring cells red), but get an error when I try to select "testrange" after moving to the next worksheet.

[Code] .....

The next worksheet is also supposed to have the same range of cells colored red, but I can only get it to work on the first active sheet.

I would like to avoid having to repeatedly rebuild the range I want selected each time I move to a different worksheet.

View 7 Replies View Related

Selecting Specific Sheets For Copy Into New Workbook?

Sep 13, 2013

I have x number of sheets in a workbook, and I am looking to copy sheets a, b and c into a new workbook that I will create.

The a, b and c are in no order, or consecutive (although they could be). I want to be able to count the number of sheets in the workbook, and traverse through that to find sheets that I need, and select them to copy over to a new workbook.

View 1 Replies View Related

Opening A Workbook And Selecting A Specific Sheet Within

Dec 19, 2006

is there any way to open a workbook and select a sheet within the book without having the entire name?
I've got a unique workbook and worksheet identifier but don't know how to use wildcards to get my macro to open the right workbook.

View 9 Replies View Related

Error Selecting Sheet In Opened Workbook

Apr 4, 2007

I have a main workbook that uses a macro to open a workbook provided to me from another department. This workbook contains a sheet that is basically a copy of the sheet in the main document and has the same sheetname and same codename.

The macro should copy the sheet data from the site workbook to the sheet in the main workbook. However, when i tell the workbook to select the sheet in the site file using its codename it errors....

View 6 Replies View Related







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