Macro To Select Next Row Of Data And Save As

Aug 20, 2009

I am pretty much a novice at this whole excel / vba stuff, but I have been trying! unfortunately I have now got well and truely stumped! I require the macro to perform a loop and once saved the first row of data, select the next row of data (in exactly the same way) until it reaches the last row. The macro I have created does the first part fine, but I have reached the end of my knowledge base!

Below is the macro I have created:
Sub TEST_1()
'
' TEST_1 Macro
' Macro recorded 20/08/2009 by ..........'
'
Sheets("Input").Select
Range("A1:CI1").Select
Selection.Copy
Sheets("Results").Select
Range("G3").Select
ActiveWindow.LargeScroll ToRight:=7
Range("G3:CO3").Select..............

View 9 Replies


ADVERTISEMENT

Using VBA To Select Data / Copy Into Template And Save As

Jan 20, 2012

picking things up. At the moment I am trying to create a macro using VBA to do the following in this exact order:

1. Delete Column A and B (once only)
2. Automatically pick up credit card number (In column A)
3. Copy all instances of this credit card number (and all data on same row)
4. Open a template I have set up
5. Paste the copied data onto a specific sheet on this template
6. Save as file name "xxxx - branch name - XXXX - DDMMMYY"
7. Repeat (loop?) this for all credit card numbers on the sheet.

There are approximately 90 credit cards, and I need a new workbook for each one to work on separately.

View 7 Replies View Related

Macro To Select All Worksheet And Save File As File Name?

Mar 6, 2012

I want to create a macro that will select all the worksheets (names and quantity will vary) and saves the file as the current file's name but in PDF. Since I only know how to record a macro it specifies the worksheet names but I need it for various workbooks. The name will vary plus the number of tabs can go anywhere from 3 to 40.

View 9 Replies View Related

Macro That Will Save Data To Specific Worksheet Tab

Feb 22, 2012

I've been using this macro to pull data from multiple files, but instead of it creating a new tab, how can I have the macro pull the data and save it on a specific tab name(ex. Comp Stores). Here's the code I have currently.

Private Declare Function SetCurrentDirectoryA Lib _
"kernel32" (ByVal lpPathName As String) As Long
Sub ChDirNet(szPath As String)
SetCurrentDirectoryA szPath
End Sub
Sub Combine_Workbooks_Select_Files()
Dim MyPath As String

[code]....

View 1 Replies View Related

Macro To Continue If There Is No Data To Select In Workbook

Aug 21, 2013

I have a macro that pulls in data from many workbooks. If there is no data in one of the workbooks the macro will not continue. Is there a loop or some other coding I need. The code for one of the worksheets is: (I am new to excel and know there must be parts that can be deleted in the below

Workbooks.Open Filename:= _
"J:SPORTSFORCESPORTSFORCE BUSINESS PLANSReporting spreadsheetCricket.xlsx"
Sheets("Numbers Report ").Select
ActiveSheet.Outline.ShowLevels RowLevels:=2
Range("A6").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Rows.Ungroup

[code]....

View 3 Replies View Related

Amend Macro To Select All But Last Column Of Data

May 12, 2014

Macro below - it now works and selects all the data in spreadsheet and converts to Proper Case

However I also need a macro to select all except the last column of data and convert all except the last column to Proper Case

It is for Post / Zip code info. so wish to keep it in Upper Case.

What I have already is:

Code:

Sub Propercase()
Dim LastRow As Long, LastColumn As Long
LastRow = Cells.Find(What:="*", After:=Range("A1"), SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
LastColumn = Cells.Find(What:="*", After:=Range("A1"), SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
Dim r As Range, c As Range
Set r = Range("A1").Resize(LastRow, LastColumn)

[Code] .....

I was hoping I could easily amend the above to select all except last column.

View 3 Replies View Related

Data Validation List To Select Worksheet In Macro

Apr 8, 2007

I have a Data Validation list in cell A1 of a worksheet called LIST. I would like to modify the macro that I have recorded, the macro uses data from various worksheets. I would like to sort out some code so that at certain points in the macro it will select the worksheet that is shown in cell A1 of the LIST sheet and then carry out the code already recorded. THis will allow me to quickly change a sheet name that is refererred to in the macro numerous times without actually manually editing the sheet name in the macro code.

View 7 Replies View Related

Macro To Check If Saved Then Save Else Bring Up Save As Dialog

Sep 6, 2012

I'm trying to make a macro check if a file has been saved (ever). If so I want the macro to do a regular save (with already esatablished filename and location) before it proceeds with the rest of the macro. If the file hasnt been saved (if it runs from a new workbook) then I want it to pop up the save.as dialog, so that the user can choose the name and location of the file before the macro continues .

The macro itself is saved in personal.xlsx.

View 1 Replies View Related

Save As Macro (macro That Opens The Save As Window)

Oct 22, 2008

I'm trying to have a macro that opens the save as window, places the name in cell f5 and then allows you to save the workbook with cell f5 as the filename. I have managed to get the save as window to come up and the cell f5 as the name, but when I press save is doesn't. Here is what I have (also, is there a way to direct this to a specific folder).

View 4 Replies View Related

Editting Macro To Select Last Empty Column To Paste Data

Nov 30, 2008

I have a macro that automatically takes data from one sheet, copies it and pastes it on another sheet, but I want it to select the empty column that is to the right of the last column to contain data (so basically the next empty column). What code would I enter into editting my macro to be able to do this please?

Also, one thing I've tried to do with my macro is that when I select the data, it's suppose to select from the first name to the last. When doing the actions for the macro, I use "Ctrl + Shift + Down Arrow Key" to make the selection select the bottom of the list. However, when running the macro, if the list is longer (or shorter), the macro selects that number of cells instead of the action of just going to the bottom of the list. For example, if during the actions of the macro, I recorded using the Ctrl + Shift + Down Arrow Key that 50 cells were selected...next time if I have 60 cells, only 50 are selected, even though I used an action command which should select all the cells in that group (in this case being 60). Is there some code I can add to that so this would work correctly?

In case its required, here is the code from the macro:

View 11 Replies View Related

Userform Vlookup With The Ability To Save Or Select Values

Apr 6, 2009

I have very limited VBA skills and I have tried to get a vlookup working on a userform. I need data from a range selected in ComboBox1 to drop into Textbox1. I have tried but it doesn't work.

I also need if possible a button that pushes the result of TextBox1 to a cell and another button that allows the user to edit the TextBox1 value in situ.

View 13 Replies View Related

Save As Macro :: Save File To Folder

Jan 17, 2010

I have a macro that copy one sheet of the Active workbook and sends it via email.

I need to add a code in this sheet so when one opens it from the email, with a command button to be able to save the file to specific, fixed folder on the local network with it’s original file name.

View 10 Replies View Related

VBA Code To Select Cell Range And Save As Text / XML File

Jul 19, 2013

I am trying to write the code to;

1) change to a different sheet
2) select a specific cell range
3) save that range as a text / xml file with a filename derived from a cell outside the given range

Here is where I have got to so far, but it fails

Private Sub Export_Click()
Sheets("Parsed Data").Select
ThisFile = Range("B1").Value
ActiveWindow.SmallScroll Down:=-15
Range("A1:A41").Copy
SaveAs Filename:=ThisFile, _
FileFormat:=xlTextMSDOS
Application.WindowState = xlMinimized

End Sub

View 2 Replies View Related

Macro To Save, Save As With Sequential Name

Feb 5, 2007

My spreadsheet has 32 worksheets, I've recorded a macro to do the job "save, save as with specific name", but what I want is, when save as, I wanted the file name increase in one number, and the date in a specific range "H8:J8" the date should be the next saturday.

here is part of the code.

Range("D11:J65").Select
Selection.ClearContents
Range("J44").Select
Sheets("NsFri").Select
ActiveWindow.SmallScroll Down:=-12
Range("A12:A21,D12:I21").Select

on this example I want the file saved as "PrA4W05.xls", being the next week "PrA4W06.xls", and so on.
and on "H8:J8" the next saturday.

View 9 Replies View Related

Macro (Select, Sort And Select)

Nov 16, 2006

I need to get a macro to select all the data in column "A", sort it in ascending order, omit the blanks if any, then select (highlight) all the data so that another macro can be run.

When I record it, it will only record up to the last row I highlight but the data always changes so there could be more or less.

View 9 Replies View Related

Macro To Save File - Save Name From Cell Containing Date Using Different Date Formatting

Aug 15, 2014

I am trying to create a macro to run from a form button, within a report, to save a file to a variable file path and name depending on the date value in cell B5.

The format of B5 looks like - 13/08/2014 16:39

The file path has folders for each year in format "yyyy" with each year having sub folders for each month in format "mm".

The file name is just the date only and is formatted "dd.mm.yy" e.g. 13.08.14

I have tried the code below in various permutations but always end up with an error - Method 'SaveAs' of object '_Workbook' failed.

[Code] ......

View 3 Replies View Related

Macro To Save As Workbook 2 From Data In A Cell From Workbook 1

Sep 28, 2012

I have two workbooks open. I need to "Save As" and close workbook 2 with a file name from a cell in Workbook 1. The macro is running from workbook 1.

I'm guessing a change in the last line. I don't know what Dim means either.

Dim FName As String
Dim FPath As String

FPath = "G:"
FName = Sheets("sheet 1").Range("A1").Text
ThisWorkbook.SaveAs Filename:=FPath & "" & FName

View 1 Replies View Related

Conflict Between Auto Save&close Macro And Show/hide Sheets Macro

Oct 16, 2009

I am trying to make a save&close workbook macro.

I found several examples on google, but unfortunatly it conflicts with another macro I use for forceing users to enable macros (hide all sheets except one if macros are disabled).

The attached file is an example contaning the save&close code and the show/hide sheets depending on macros enabled.

If the file is opened with macros disabled then only one sheet will be visible.
If the file is opened with macros enabled other sheets are visible.

The problem if that this code uses a custom save, witch makes the save&close not save... (in module1 and in ThisWorkbook)

The pourpose of the save&close is to make sure some users don't forget the excel open and thus block access to it. So if a certain idele time passes excel has to save and close without any confirmation messages.

View 10 Replies View Related

Pause Macro - Select From A Drop Down - Restart Macro

Dec 18, 2007

I am trying to pause a macro on a protected sheet, select 2 adjacent cells (initially protected), utilize an existing drop down box to select a name from the list, copy the name from the list into the range of cells, then re-start the macro.
I had no problem when there was just one name (see John Smith below). I tried to use the InputBox command but needed to actually type in the name.

ActiveSheet.Unprotect
Range("C27:D27").Select
'ActiveCell.FormulaR1C1 = "John Smith"
' Application.CutCopyMode = False
' ActiveSheet.Paste
'Range("c27:d27") = InputBox("Enter value")

View 4 Replies View Related

Macro To Select VbYesNo When Calling Another Macro

Apr 20, 2008

I have a workbook with a 2 macros "PopulateSheetlist" and "SaveEditedversion"

Normally they are each button operated, and prompt the user with vbYesNo style options. I wanted to write a Macro, say "Macroautomatewkbk that would automatically answer the prompts.


Sub Macroautomatewkbk ()

Call PopulateSheetlist

' Always answer YES or OK to any prompts this macro may offer

Call SaveEditedversion

' Answer No for the 1st prompt and YES for the 2nd prompt

End Sub

MsgBox "Both macros "PopulateSheetlist" and "SaveEditedversion"

' Some error handler here, don't know how this should work exactly.
Could any one please explain how to fill in code in the commented sections in the above sample code?

Edit: I tried recording a macro to do the above, but it only showed the zooming and scrolling that occurred, none of the button prompts being answered.

View 9 Replies View Related

Copy Data From A List Then Paste Into Another Workbook And Save As One Of Data Copied

Jun 15, 2014

I am trying to create a macro to copy a set of datas in a row , paste into another workbook (specific sheet),then save it as one of the datas that was copied over.

Workbook1

Ticket#
Description
Name

12345
Test 1
David

32145
Test 2
Steve

Workbook2 - sheet (ABC)

Copy row 2 from Workbook1, paste to row 1 in Workbook2 sheet(ABC)12345
Test 1
David

Saveas Workbook2 - ABC - "12345" - Ticket #

Copy row 3 from Workbook1, paste to row 1 in Workbook2 sheet(ABC)

And so on. I will have a set of data to trasfer to Workbook2, each row different workbook.

View 4 Replies View Related

Macro To Save As PDF?

Nov 30, 2011

I have a macro that saves each sheet of my workbook to PDF's. I have a macro that runs prior to the save macro that filters each sheet and hides rows I do not need printed.

I simply use a formula to show a 1 in column H.

What I would like to do is sum let's say rows 5:58 and it H59 is below let's say 5 that sheet is not saved as a PDF.

I looked for awhile for a if.then macro that might solve my question, did not see anything that fit.

View 2 Replies View Related

Macro For 'Save As'

Nov 14, 2006

I want to specify a button that have the function of prompting the user to save the file as new file name. I tried to do the record macro, but I think it's not working as I wanted to. Can any expert teach me the code? As I was creating a standard form (excel file), I don't want the users to overwrite the current file name.

View 9 Replies View Related

Macro To Save As Txt

Jul 10, 2008

I work with a read-only template, and desperately need a macro that would save it as a workbook, and every worksheet of it as a separate txt file, then close the whole thing.

I will be re-using that workbook it just saved again, and I want to have the same macro there as well (that it should save my workbook as workbook and every worksheet as a separate txt file).

View 9 Replies View Related

Before Save Macro

Mar 27, 2009

In My sheet I would like to check to make sure col 15 is true before going through the process of adding the contents of each row from col 6 - 10 to column 5. (Col 5 could already contain values)

This is my
Private Sub Workbook_ThisWorkbook(ByVal SaveAsUI As Boolean, cancel As Boolean)
BeginRow = 8
EndRow = 87
ChkCol = 15
BeginCol = 6
EndCol = 10

For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value = True Then
For RowCnt = BeginRow To EndRow
Cells(RowCnt, 5).Value = Cells(RowCnt, 5).Value + Cells(RowCnt, ColCnt).Value
Next ColCnt
End If
Next RowCnt
End Sub

View 9 Replies View Related

Macro Will Not Save

Apr 3, 2009

when I record a macro in excel and assign it to a command button, it does not save and have to keep recording it when I open up the workbook again. I notice when i close out of the script editor after saving, the debugger box does not pop up when on most occassions it does.

This does not happen all the time, just some of the time which makes absolutely no sense to me. I have double checked to make sure the module is saved under the current workbook, i have tried saving the script to my personal macro workbook (XLSTART), i have tried saving the file on a shared drive and my desktop, but nothing seems to work. The workbook is not protected and am at a complete loss.

View 9 Replies View Related

Save A Macro Under Another Name

Aug 8, 2009

so i can save the macro and try (usually unsuccessfully) to change it.
excel 2002

View 9 Replies View Related

Macro To Save Only Some Changes

Jul 14, 2006

I have a 4 sheet workbook. 3rd and 4th are hidden running formulas. These hidden sheets have macros that creates a new file from each (the macros deleted unwanted rows in the files, then save as a seperate file and format [.mht and .csv respectively]). Everything functions properly, except the problem is, I need to make sure the changes to sheet 1 are saved, but when I save the file, the changes to 3 and 4 are saved, and I lose the formulas.

View 4 Replies View Related

Run Macro After Save

Jan 17, 2007

I would like to run a macro AFTER the user has saved the workbook. I can only think of manipulating the before save event but dont know how to do that.

View 9 Replies View Related

Excel 2007 :: Using Formula On Filtered Data - How To Select Only Visible Data

Jun 1, 2011

I have a 5000 line table I am filtering by a few columns, and I'd like to calculate an exponential trendline value.

=INDEX(LINEST(LN(R1059:R1167),W1059:W1167),1)

But I actually don't want all the values from R1059 to R1167 - I want to select only the displayed values (R1059, R1068, R1077, etc). Is there a way to select only display values to use in a formula? The problem is it would be a lot of manual work to select them all - there are 50 or so instances I would have to select 13 manual values.

I am using Excel 2007 on XP.

View 8 Replies View Related







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