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
ADVERTISEMENT
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
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
View Related
Mar 29, 2013
#in order of priority
#1 So what I want to do is copy multiple rows from a table into another table, but only info from column a,b and c of that row into the other workbook's table. So I need to search for the number that is in E1 of workbook#1 and pull the rows that have that number from anywhere down column E of workbook#2. But I only want the info from cells a,b and c of the rows to transfer over.
#2 Also how to pull that off on all the sheets 1,2,3,4,5,6,7,8,9,10,11 and twelve of workbook#2's column E's into one list in workbook#1.
#3 How to put a button for the macro so if I change the value in E1 I can just hit it to repopulate the workbook#1 with a new list.
#4 How to pull from page 1-12 of workbook#2 but also a workbook#3 as well.
View 5 Replies
View Related
Dec 17, 2013
I have 2 tabs (tab 1 is "Data", tab 2 is "Compare")
Data tab is filled with results from tests I do in a lab, each test has its own row, each 'test subject' has its own column.
In the second tab I want to have the ability to pick from a drop down list one of the other columns from the first tab.
So I have 2 columns (D and F) in tab 2 with drop down lists that I have populated with the names of the test subjects (using data validation grabbing the top row in tab 1).
I have formulas set up in Column E of tab 2 for the actual comparison.. What I'd like to do is when I select a test subject (for example SubjectA), from the drop down list in $D$1.. I want to populate $D$3:$D$155 with rows 3-155 of the matching column in tab 1 (so if for example SubjectA is in column X, it would copy from tab 1 X3:X155 to tab 2 D3:D155.
So so far I have the validation part done with the drop down list.. and I have the following VB code for tab 2.
View 4 Replies
View Related
Mar 13, 2007
I have been working on an app for a while now and it works for all our PC users. We have some folks in corporate who have macs and the thing just falls on it's face. So, I have taken out the vba on the thisworkbook start up bits in hopes that it can just open and go from there. This is also problematic. So in search on the web, it looks like Macs do not like VBA. So I decided that since the main page entry is just standard formulas, I would just remove all the modules, forms and macros out of the workbook so the whole problem side could be avoided. Well no such luck. When I open it, it asks about macros. If I disable them, it tells me that the macro can not be disabled in 4.0. I built the app in 2000 as it is the lowest version in the office. But this really shouldn't matter because there are no macros in it to start with.
So, my question is... How can I make a very basic, mac safe version from my PC version. I can draw up some VBA to open the mac version and suck in the info I need and save it to PC land.
View 9 Replies
View Related
May 21, 2014
I used the button in Excel 2010 to record a macro that allows me to format a workbook font and stuff because i do that many times a day for several workbooks. However I want to be able to just push a button and have all open workbooks run the macro I recorded.
I am able to make a button- thats easy, but how do I get it to run for ANY workbook? My problem is that apparently it only runs the workbook that is named a certain way. should i post the code here?
View 1 Replies
View Related
Feb 26, 2009
I'm trying to do is record a macro that will copy data from cells A1/A2 of Test.xls and paste it to cell A1/A2 of Text2.xls. Then when I run the macro again, it will copy B1/B2 of Test.xls to B1/B2 of Test2.xls, and then do that for the remaining cells.
View 9 Replies
View Related
Nov 9, 2006
I am moving some sheets into a new workbook and from the new workbook I want to prompt the user to save the workbook where they see fit. For some reason I cannot seem to save the new workbook only the old with the below code.
Sub Moving
Dim wb As Workbook
Set wb = ThisWorkbook
Sheets( Array("Hk", "Li", _
"SAM")).Select
Sheets("SAM").Activate
Sheets(Array("Hk", "Li", _
"SAM")).Copy
If wb.Saved = False Then
Select Case MsgBox("Do you want to save your changes?", vbYesNo Or vbExclamation Or vbDefaultButton1, "J & R Solutions")
Case vbYes
wb.Close True
Case vbNo
wb.Close False
End Select
End If
View 2 Replies
View Related
Sep 22, 2012
Why does my macro mess up on second line C23 and not places Play Equipment or the amount in the right column it stays on row C22
[URL]....
Code:
Private Sub CommandButton1_Click()
Dim SheetName As String
SheetName = "Estimate1"
SheetName = InputBox("enter the name of a sheet to use", "sheet name", SheetName)
[Code]....
View 2 Replies
View Related
Jul 25, 2008
I have been trying to create a Macro that can do the following.
Open a Excel Workbook, Copy the Worksheets that I need (ignoring ones that are not needed.), Save them in the correct location with a new folder of date and time and saving them as csv files.
I have all the elements but can't seem to get them to gel correctly.
Just wondering if anyone has anything like this that I could adapt or edit.
View 9 Replies
View Related
Jul 10, 2007
I am trying to open a closed workbook, auto update and save. Here is the code i have so far:
Dim xlBook As Excel.Workbook
Try
xlBook.Add()
xlBook.Open(FileName:="C:Old Tanglewood Numbers.xls", UpdateLinks:=1)
Now, the xlBook.Add() line is something I just added. I am not sure if it works but i dont think it does. Everytime i try to use Workbooks.Open it tells me that i need to decalre Workbooks, which i thought i did with xlBook. Anyway, I cant get it to work, something is throwing it out of whack.
View 9 Replies
View Related
Mar 31, 2014
I have a sheet made into a form with some check boxes included. If I select all the relevant columns, create a new sheet, and paste into cell A1 - all of the information carries over just fine. You can still select cells and check the boxes in the new sheet.
However, when I record this action as a macro, using the macro produces a picture of the selected columns instead of actually copy/pasting the information. I can't click on the cells or check boxes. I can only move the picture around within the new sheet.
View 7 Replies
View Related
Feb 26, 2014
I am attempting to save a workbook when it opens, but when the code is run, it is not saving. For the purposes of finding the problem with the code, I have simplified it down to the following:
Code:
Private Sub Workbook_Open()
Range("C3") = "HEY"[code]......
View 8 Replies
View Related
Aug 4, 2008
I only want to change some Visual Basic Editor (VBE) font settings on the active workbook, but whenever I do so within the Editor tab of the Options dialog it changes the VBE font settings for all workbooks.
Is it possible to change just the active workbook VBE font settings or do these settings reside in some *.ini file that once changed, globally changes the setting(s).
View 3 Replies
View Related
May 1, 2013
I have been running a macro on a continuous loop to collect data for months. Yesterday I added something small to the macro and now it does not select cells. I tried closing excel, opening a new page and have a simple macro
Sub Please_Work ()
Range('A4').Select
End Sub
If I have VBA open and step through it (F8), it does NOT work. If I run the sub (play button), it does NOT work. If I close VBA, and run the macro it DOES work.
View 9 Replies
View Related
Sep 21, 2013
macro visual basic and trying to do a simple report wherein i can send an email auto matically.
View 2 Replies
View Related
Mar 30, 2014
The following macro works:
Code:
Range("b42").Resize(, Len(Range("A42").Value)) = split(StrConv(Range("A42").Value, vbUnicode), Chr(0))
I tried to revise the macro so that instead of 'b42' it's activecell.
Code:
Dim b As Range
Set b = ActiveCell
Range(b).Resize(, Len(Range(b).Value)) = split(StrConv(Range(b).Value, vbUnicode), Chr(0))
My code isn't working.
View 2 Replies
View Related
Nov 19, 2007
I have a excel file that was created by someone else 7 years ago - I still want the formulas that were created but I have updated the information on the spreadsheet and now the macro will not work
Sub DataSort01()
'
' DataSort01 Macro
' Macro recorded 11/18/00 by Terry Schiesser
'
' Keyboard Shortcut: Ctrl+t
'
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:=">0", Operator:=xlAnd
End Sub
when I do the ctrl+t it wants to debug I select the debug option and then it goes to the screen above but the "Selection.Autofilter" is highlighted.
View 9 Replies
View Related
Jun 3, 2006
I would like to do is develop a stand alone program in Visual Basic ( not in Excel VBA) to update the price file in our Portfolio system automatically using the downloaded Excel format file csv extention file from the BigCharts. But before that, I need to export the *.pri file from our Portfolio system in to Excel which still saves as *.pri extention. Then once it updates, I import the updated *.pri file back in our Portfolio program. I understand that the Excel VBA code can be incorporated in Visual Basic code provided there is an object declaration for Excel file (In this case eventhough the both files are in Excel format, they don't have xls extention). how to use external files and Excel VBA code in Visual Basic?
Below is the code that I currently have in Visual Basic. What I'm trying to accomplish is using the ticker (eg. msft) as a keyword search to look up in the price file. If found , the price of that ticker from the test.csv file will be copied in to the price file which is test.pri. I haven't ran it yet.
Sub UpdatePrice(BigChartPath As String, BigChartName As String, AxysPricePath As String, AxysPriceName As String)
'Below are Excel VBA codes
'Uses the test.csv to look up tickers in test.pri and update the price in it
Dim PriceFile As Workbook, BigChartFile As Workbook
Dim PriceFileSheet As Worksheet, BigChartSheet As Worksheet
Dim MaxRows As Long
Dim PriceFileRow As Long
Dim BigChartRow As Long
Dim BigChartFound As Boolean
Call CheckBookOpen(BigChartPath & BigChartName)
Call CheckBookOpen(AxysPricePath & AxysPriceName)
Set BigChartFile = Workbooks(BigChartName) 'Big Chart website imported CSV file saved as test.csv...............
View 5 Replies
View Related
May 26, 2014
I have the code below which copies columns A:C from Book1 into Book2. However, it does not work when the Book1 is not open. I would like the macro to still work when the Book1 is closed.
Sub CopyColumnToWorkbook()
Dim sourceColumn As Range, targetColumn As Range
Set sourceColumn = Workbooks("Book1").Worksheets("Sheet1").Columns("A:C")
Set targetColumn = Workbooks("Book2").Worksheets("Sheet1").Columns("A:C")
sourceColumn.Copy Destination:=targetColumn
End Sub
View 2 Replies
View Related
Jun 26, 2013
how to write macros. Here is what i need:
-I need the macro to only search within column "B"
-There is both a date and time within the cell, the time is always " 00:00:00" and I need it to be replaced with blank/ ""
- The date is represented "1/1/2013" and i need the "/" to be turned into "-"
- and i need the number format to be changed to a custom format of "m-d-yyyy"
View 1 Replies
View Related
Nov 12, 2009
I've been helping another user create a workbook that dynamically adds, renames and deletes worksheets from a "Main Sheet".
I have got the whole thing figured out and running to satisfaction, except...
The macro runs fine if the Visual Basic Editor is open. If the editor is closed while the macro is run, I get "Runtime Error '9': Subscript out of range"
Any ideas what could be casing this? The errors occur when attempting to add sheets.
View 2 Replies
View Related
Apr 26, 2007
I have created macros before, but it was a step by step, easy to follow, guide from out textbook. Now I have to create one on my own from these directions.
So my first task was to create a macro that went to a specific worksheet, and made A1 the active cell. I created that macro.
Now it comes to where I have to open the macro in Visual Basic Editor and I am completely lost. I know absolutely nothing about this. This is what it looks like now:
Sub Show_Report()
'
' Show_Report Macro
' Macro recorded 4/25/2007 by *******
'
' Keyboard Shortcut: Ctrl+w
'
Sheets("Jeff").Select
Range("A1").Select
End Sub
So now these are the next directions. "Edit the Show_Report macro in the VBE so that the macro prompts the user for the name of the report to view (indicating that the user should enter "Jeff", "Sally", "Jane", "Jim", and "Harry") and then displays that worksheet. (HINT: You should run the edited macro to make sure that it runs correctly.) Include an If-Then-Else control structure to detect an error if the user enters an incorrect report name. If an error occurs, the macro should display a message box informing the user of the error.
So what Im thinking is I need a code so what when I hit my macro hotkey, it opens up a pop-up box and then I get to type in a worksheet name and it takes me to that worksheet.
View 9 Replies
View Related
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
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
Feb 2, 2010
I am getting the error from the title of the thread when I try to change a worksheet name.
This worksheet name doesn't already exist in the workbook and I don't have any other files currently open.
I'm not entirely sure what is causing this, but I do need the sheet to be the name I am trying to change to.
View 9 Replies
View Related
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
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
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