Format As Well As The Value In Macro

Nov 15, 2009

In a macro, I calculate fees (Bold Blue format) on a sheet "Fees" then copy one value to sheet "All Vertical". The values come out regular and black. How can I copy the format aswell?

View 2 Replies


ADVERTISEMENT

Macro Or VBA - Search General Format Convert To Date Format

Oct 26, 2012

Every month, I have an import a report to a spreadsheet. At my column A, it supposed to be a date format.

For some reasons, I have a combination of a few cells of date format and a few cells of general format with no order at all.

What I need is: Search in the A column, if date format leave it , if not change from general to date format.

View 2 Replies View Related

Macro To Change Date Format To General Format

Oct 17, 2012

I have two columns where there are dates (e.g. 11/05/2009) in a date format; I would like to change the format to `general`; but without losing the original values, i.e. I still want to see 11/05/2009, but just in `general`format. Is it possible to create a macro that will do that? I want these values to stay in the same place, i.e. if it is in cell K10, I still want to have it there - just in other format.

View 9 Replies View Related

Macro To Format Numbers And Justify Format

Jul 26, 2014

I have tried to write code to format numbers to zero decimal places as well as to justify the format as the zeroes appears as 00000000 when imported.

I need the macro to do this on the first 7 sheets.

I also need ------- lines and ) to be cleared on the first 7 sheets.

I have attached sample data and my code below

Code:
Sub Format_Data()
Dim Cnt As Long, i As Long
Cnt = Sheets.Count
Application.DisplayAlerts = False
For i = Cnt To 7
Range("F:H").Select
With Sheets(i)

[code]....

View 1 Replies View Related

Pause Macro, Allow Format, Resume Macro

Mar 14, 2007

how to interrupt VBA code, allow user modifications to a chart, and then continue the code where it left off with a click of a button. I currently have the code in place where a UserForm pops up at a specific point and tells the user to make adjustments and press OK when done. It works fine but the UserForm displays and the macro resumes when OK is clicked, but I can't figure out how to activate the chart or the spreadsheet to allow editing while that UserForm is on the screen. If only I can get excel to allow me to sleect the spreadsheet and make changes while the UserForm is on the screen, I would be set. Can anyone please help me with any options to allow editing while the UserForm is on the screen so I can edit and then click the OK when done?

I posted something similar to this over two years ago. The way I got around it at the time was to break the code into two separate subs. This time around, the code is making 17 graphs and I want to ask for editing for each one before continuing. That would be a lot of individual sections of code.

View 9 Replies View Related

Date Format In A Macro?

Jan 30, 2014

Below is a macro which i got from another thread.

Sub foo()
Select Case Weekday(Date, vbMonday)
Case 1: Range("B3").Value = Date - 3
Case Else: Range("B3").Value = Date - 1
End Select
End Sub

change the date format as mm-dd-yyyy.

View 9 Replies View Related

Macro To Format A Document

Dec 20, 2007

I am recording a macro to help me with formatting a document. I know do this manually, but realized that if I record a macro and run it the process would be faster. I have tried this and it works really well. However the problem is that although the columns are always the same, the rows increase and decrease everytime I download the raw report.

When I record the macro and then run it, it only selects the number of rows that I choose when I record the macro. I am sure there is a way to have the macro look for date and then stop after there is no more rows, but I can't find it in help.

I have tried selecting the whole document, but that slows the automated formatting down significantly.

View 9 Replies View Related

A Macro To Format Data

Aug 24, 2009

I have been trying to produce a macro that will format data of varying lengths. Basically, I pull data from a database and export it into excel. I have a macro that will format the first few lines fine. Unfortunately, there are a few lines of info at the end of each report that need to be deleted. I cannot figure out how to make excel reach the end of my data a delete these two lines. If I build the macro on one report that has 100 lines and delete line 99 and 100, and then attempt to run the macro on a report that has 150 lines - lines 99 and 100 are still deleted.

Is there a way to delete the last couple of lines of data of a spreadsheet?

View 9 Replies View Related

Format A Picture With A Macro

Oct 11, 2009

I'm watching an educational D V D on my computer, and take notes in excel. I repeatedly use the print screen command, then go to excel and paste in the picture, though it is too large. I resize it to 50% and I'm done. What kind of code do I need to use to paste and shrink the picture to 50%? Also, how do I attach a shortcut key to this action (for example Ctrl+M)

View 14 Replies View Related

Macro To Format Range

Nov 20, 2009

i am getting is it only formats H11:AE12 & H14:AE15, It does not format the first range or any others. Am i doing something wrong? I recorded the first one H8:AE9 then just added the ranges for the others, have i missed something?

View 3 Replies View Related

Macro To Format CSV Files

Mar 22, 2012

I've successfully managed to run a macro to format a .xls file on opening it. How can I do the same with a .csv file?

View 1 Replies View Related

How To Format Data With A Macro

Jun 28, 2012

check and format some data with some code.

I have 100,000+ rows that look like this

Sheet1 *ABCDEFG1start_date start_time end_date end_timeTypeSOC Before SOC

After208/01/201218:36:2008/01/201218:40:00T**308/01/201218:45:1208/01/201218:50:44T**408/01/201218:52:1208/01/201219:50:46C3446508/01/201219:54:2708/01/201221:44:40C4681608/01/201221:48:4108/01/201222:02:36C8187708/01/201222:06:4608/01/201222:11:49C8787808/01/201222:15:5008/01/201223:02:00C87100909/01/201208:16:5109/01/201208:44:08T**1009/01/201208:45:1109/01/201208:49:55T**

I'm trying to merge all the "C" types in Column E into one row like this

Sheet1 *ABCDEFG14start_date start_time end_date end_timeTypeSOC Before SOC After1508/01/201218:36:2008/01/201218:40:00T**1608/01/201218:45:1208/01/201218:50:44T**1708/01/201218:52:1208/01/201223:02:00C341001809/01/201208:16:5109/01/201208:44:08T**1909/01/201208:45:1109/01/201208:49:55T**

So basically, I need to use the 'start date' and 'start time' from the first row and the 'start date' and 'start time' from the last row. Also use the first 'SOC before' and the last 'SOC' After'.

I have more data in column h - column z, so I need to delete the entire row of the additional "C" rows. Otherwise the data will be misaligned.

View 2 Replies View Related

Macro To Format Cells Only Once

Jul 5, 2012

I have a spreadsheet that uses a macro to format it. It’s quite simple and the code is shown below:

Code:
Range("A1:D2").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic

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

The spreadsheet will have info constantly added on (downloaded from a CSV).

What I would like the spreadsheet to do is look at the cells and only format those that have data in them but are not already formatted – otherwise I’ll just end up re-formatting everything every time and as the spreadsheet gets bigger it'll take longer and longer.

View 6 Replies View Related

Format Data With Macro?

Jul 22, 2012

Macro or formula to reformat some data.

I have like data like this:

Column A = Date
Column B = Single Distance
Column C = Total Distance for that date

Sheet1  ABC1DateIndividual Distance Total distance 204/01/2011919304/01/20111019405/01/2011
212505/01/20111012606/01/2011926706/01/2011326806/01/20111026906/01/20112261006/01/2011226

It would be really useful if I could format it like this

Sheet1  FGHIJ1Total Individual 219910  312210  42631022

So basically, it puts all the information on one row for a particular date.

View 7 Replies View Related

Macro To Format All Pages The Same

Sep 12, 2007

Im trying to get a macro that will set every sheet in the workbook i am usine, to match sheet1.

Sub LOOPY
Dim WS As Worksheet
'Loop through all worksheets
For Each WS In ActiveWorkbook.Worksheets
'Do this for all sheets except these sheets
If WS.Name = "Pcard Statement" Or WS.Name = "namedranges" Then
'Do Nothing
Else
'copy "pcard statement" page setups/print magins
Sheets(WS.Name).Range("A1").PasteSpecial Paste:=print margins?
End If
Next WS
Application.CutCopyMode = False
End Sub

View 9 Replies View Related

Macro Changes Number Format

Nov 27, 2008

From an accounting system I download txt files that then are read into Excel in order to be workable. The numbers come out like this 1.234,00 (ie decimal as comma separator and dot as thousand separator). This does not work in Sweden so I need to get rid of the dot.
I have built a macro that apart from taking out the dot makes some other changes to the data so that one wont have to do the same thing everytime ones downloads the same type of file. The problem is that when creating the macro or just doing the text to column, number format, replacing . with nothing it all works well but when I run the macro some of the numbers become text, others are ok and for some of them the macro does not only take out the dot but also the comma (which makes a huge difference). I have both Excel 2003 and 2007 and the same thing happens with both.....

View 9 Replies View Related

Format Data In Macro

Dec 15, 2006

I have cells which contain dates in the typical Excel format. IE: Jan 3rd, 2000 in unformatted form shows up as 36528 in Excel in Cell A2. What I would like to do, in VB, is take the contents of that cell A2 (36528), and turn it into a date in the form of:

Year,Month,Day
(For instance, Jan 5th 2001 would be
2001,1,5
And then assign it to a variable

View 4 Replies View Related

MACRO To Change Date Format?

Mar 31, 2014

I have an excel dataset and I have dates entered differently. For example they could be written as:

MM/DD/YY
MM/DD/YYYY
M/D/YY
M/D/YYYY
....
....

Ultimately what I am interested in doing is writing a macro (and saving it in its own file) that can be run on any excel spreadsheet that will change the dates to be formatted the same: MM/DD/YYYY

The issue is that a date written as 10/10/27 would need to be changed to 10/10/1927 (so adding the 19).

View 1 Replies View Related

Macro Opening TXT As Workbook Changes Format

Apr 3, 2014

I am having problems to read a number inside a .txt file.

I use this code to open a .txt

Workbooks.OpenText filename:=data_DMC_filename _
, Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:= _
False, Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array _
(1, 1), Array(2, 1)), DecimalSeparator:=",", ThousandsSeparator:=".", _
TrailingMinusNumbers:=True

At original file the number is like this format: 003791689000011403700010, but after opening as workbook it is like this 3,7917E+21

I tried changing the forma to text with this code bellow, but it looses information

Selection.NumberFormat = "0"

and the result is: 3791689000011400000000

I already wrote a lot of my code for other values, using this Workbooks.OpenText command, opening as workbook so I would not like to open the file in text format or so...

View 1 Replies View Related

Lost Format After Running Macro

Jun 5, 2014

I have a summary sheet using a macro to summarise multiple other worksheets. However, when I run the macro, the summary sheet loses all formatting.

For example, in one column of the "target" worksheets, the data is entered on multiple lines within a single cell, using alt+shift. When I run the macro the formatting is lost and the data in this specific range is displayed in one long row in a single cell. Also, font formatting is also lost.

In the attached example, the top row shows the original formatting on the "target" worksheet, but below that is the formatting after the macro has run and this is what shows on the summary.

I need it to be formatted as on the original if possible.

View 5 Replies View Related

How To Make A Macro To Format All Cells

Jun 5, 2014

I would like to make a macro to format all my cells.

I need it to format my last digit to superscrift IF there is 4 digit after decimal point.

How to do this?

View 14 Replies View Related

Macro To Move Data To Another Format

Feb 25, 2014

I'm looking for a macro to select data from a larger data set, and then put it in another worksheet. Basically, I want to select any cell in column A that contains "SO5" and move those to the column A of a separate worksheet. Then, for each cell that contains "SO5" would like to move to the right 5 columns and down 3 rows and select from that cell all the way to the end of the table. There may or may not be data in all of the table cells, so the selection should be based off of the column headers which will always have values. I would like to take that data and put it with the corresponding "SO5" in the new sheet.

Here's a sample:

MacroSample.xlsm

This is a simplified version, but I'm trying to get the data from sheet1 into the format in sheet2. Keep in mind that the number of columns and rows may change so it needs to be as dynamic as possible.

View 1 Replies View Related

Format Data To Another Sheet Macro

Feb 23, 2009

I import a raw data file from our phone system into sheet 'imported', I then want to display the data on sheet 'formatted' how I have displayed it for the purposes of this example. I had a solution to this but the formatting out of the phone system has changed.So I need it to list the agents names, and then the corresponding time for each activity. The activities are listed on B3:I3.

View 2 Replies View Related

Macro To Format The Auto-Sum Row Without Knowing What Row# It Will Be

Mar 20, 2009

I currently have a macro setup that puts Auto-Sum data in the row below the bottom-most row of data. What code would I need to format this Auto-Sum row with the following parameters automatically...

1. Merge & center F & G in the Auto-Sum row with the text "Totals".
2. Change the row height of the Auto-Sum row to 44 pixels.
3. Center the vertical alignment of the Auto-Sum row.
4. Put the thickest border around the Auto-Sum row in cells A-K.

View 14 Replies View Related

Change Calendar Format With Macro

Mar 24, 2009

change format of date in UserForm textbox base on value in selected item of combobox.

View 7 Replies View Related

Changing Date Format Macro

Jun 17, 2009

I would need a macro what would change this format (15 Jun 2009) in cell B2 to 2009.06.15.

View 5 Replies View Related

Required Macro To Format The Raw Data

Sep 16, 2009

Iam just trying to format an raw data(which has morethan 40,000 rows) which is converted from notepad to excel.

The major problem the token number which is below the name and quantity i need to bring the number to left side of the row.

i think this has not given an clear picture so iam attaching an sample sheet

View 6 Replies View Related

Clear Data Not Format With Macro

Nov 7, 2009

I have a worksheet (“A”) that is populated from a second sheet (“B”). The data on “A” changes as necessary using another Macro. Most of the data on sheet “B” is numeric and comes from various formulas and results in numbers with too may digits after the decimal point. I can format sheet “A” to turn 58.22222222 into 58.2 but when I run a Macro to clear the data I lose the formatting. I need to find a way to clear only the data and not the format, or find a way to add a mask on specific columns in the macro that copies and pastes. Here is the Macro to clear the data.

View 3 Replies View Related

Macro To Convert Date Format

Sep 6, 2012

I have dates in Col E that are in mm/dd/yyy. I would like a macro to convert these in the format dd/mm/yyyy.

View 9 Replies View Related

Data Format When Running Macro

Feb 20, 2007

I am having a problem with a macro which has only started occuring on Excel 2000. It worked fine on Excel 1997. Basically, the Macro converts a text file (with comma delimiter) to an excel format. The problem I am having is with some of the date fields in the text file.

All dates in the Text file are in the format dd/mm/yyyy (i.e. 01/02/1990)

If I convert the Text file to Excel format manually through the wizard it correctly converts the date in Excel to dd/mm/yyyy (01/02/1990). However, If I run the Macro I have created, it converts the date to mm/dd/yyyy (02/01/1990).

This only seems to happen if the dd field is less than 12.

I attach a sample of the text file and Excel file (with incorrect dates) and also the Macro.

Basically I need the Macro to convert the dates in dd/mm/yyyy always....

View 9 Replies View Related







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