Writing Numbers Using Macro

Oct 16, 2009

I'm trying to use code to write the numbers 1 to 100 in 10 rows of 10

1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16......................

So far i have the following which works:

View 4 Replies


ADVERTISEMENT

Writing A Macro For Work That Can Loop Through Reference Numbers

May 13, 2014

I have attached a screencap of an example source table that I am trying to write a macro to manipulate each day. Starting conditions are that I have data in column A and B. Column A would be reference numbers that may be on one line, or more likely, on multiple lines repeating with varying counts. Column B is the weight associated with each line. I would need a macro that could loop through column A, determine if the ref number has changed, and then calculate/populate column C. Column C is the % of the total weight for the unique reference number. I have illustrated this in the table using column D. This is taking me incredible manual effort to complete right now and I do know VBA, I just don't know how to loop a variable range in this case.

View 9 Replies View Related

Writing Numbers To Appear In Time Format

Jun 26, 2014

I'm trying to write a certain number, e.g. 300355, to appear as 03:03:55 and in the time format. I've already managed to make it appear with the punctuation between by formating the cell with 00:00:00. However I need to work with the cell in a time format because I'm using stats from a program that records time spent on/off a phone. To be exact I need to sum up 4 cells and divide each one with the total to get the % of time spent on the each category, (total talking, total ready, total not ready and total working).

If I use the format I've been using (00:00:00) the % gets slightly off the true value. E.g. if the numbers are the following:

Total talking: 03:36:53Total ready: 00:55:37Total not ready: 00:52:53Total working:02:40:37

I would get 45%, 11%, 11% and 33%, accordingly, by using the values in time format but 49%, 8%, 8% and 35% by using my format.

So the question is, is there a way to write the numbers as 33653, 5537, 5253, 24037, appear as 03:36:53, 00:55:37, etc. and be in time format?

View 3 Replies View Related

Writing Macro To Check Cell Population And Then Run Another Macro

May 14, 2014

Basically, what I'm dealing with is an inventory system. When a cell value reaches below a certain quantity, we have a cell light up with the word "YES" (under the "re-order" column). What I'd like to do is have a macro that checks to see if that cell is populated with "YES" and if it is, to run another macro (which I already have written) that sends out an email notifying us of the need to re-order.

How it would work: The person pulling out the inventory would fill out this form and click "Submit"

submitbutton.jpg

I would then have a "call" code tied to the "Submit" button that when clicked, would run the macro to check cell population and send out the email. The email code is already written and works flawlessly on it's own. I just cant seem to figure out how to write a macro that checks for cell value and then runs it (or not) based on that.

View 14 Replies View Related

Writing Macro

Jul 3, 2007

i have an report in which i need to delete the entire row if the column contains values more than 250K, but the chanllenge here is; if any of the cells in the column contains a formula then the macro should not delete the row.....

View 9 Replies View Related

Writing VBA Macro Or Function

Nov 5, 2007

I have Asset Class in Column I and if it is 364A-EL or 365A-EL or 368A-EL or 368B-EL or 369A-EL or 371A-EL or 371B-EL or 373A-EL or 397C-EL then 'POLES' assigned in to Owner Class (Column J).

If Asset Class is 366A-EL or 367A-EL or 367B-EL or 368C-EL or 369B-EL or 371C-EL or 373B-EL then assign UGCBL to Owner Class.

Should we write the macro or can it be accomplished by any Excel Function?

View 11 Replies View Related

Writing/modifying An Macro

Oct 18, 2007

Every month I download a report from a state agency that I need to reformat, create charts from and send reminder emails based on some of the data. The report is downloaded as an EXCEL workbook containing a single worksheet. The worksheet is preformatted as a printed report. I have no control of this formatting and I can not get the data as a .csv file. The report contains 3 sections. See detailed report description below.

What I want to do:
1.Is copy the 3rd section of the report to a new worksheet.
2.Sort the new worksheet by name, and date.
3.Filter some names based on resource type.
4.Create a new file, which will be attached to an email to my boss for follow-up.

Originally I used the built-in EXCEL macro recording function and this worked for a couple of months. Then the number of rows in the 2nd section varied and my generated worksheet failed to sort correctly, and I lost the column headings so my filter no longer worked. The results were not something I could forward. I do not know how to modify the macro to search for the literals which end section 2 or start section 3 so I can copy the correct data to the new worksheet. I am not a VBA programmer, just an old-fart trying to do some administrative volunteer support for an important program, and really do not want to become one.

Detail Report Description:
Section 1: Headings –contain fixed headings in merged & centered cells.
Row 1 – Report heading 1 in merged cells A1–I1
Row 2 – Report heading 2 in merged cells A2-I2
Row 3 – Report heading 3 in merged cells A3–I3
Row 4 – Blank row............

View 9 Replies View Related

If Statement When Writing A Macro

Dec 10, 2008

I am trying to write an if statement in my macro. It is not returning what I want. Can anyone tell me where I have gone wrong.

Dim D As Variant
D = Sheets("Instructions").Range("n3").Value
If D = 1 Then
'range("n5).value
Else
'range("b3").value
End If

View 9 Replies View Related

Writing A Macro To Hide Rows

Sep 23, 2008

I am now trying to hide rows when the data in a column matches that of a cell with a data validation list. Ideally i would like only the rows with matching data to show. When the cell is changed then the visible rows change and when the the entry "total" is selected all the rows are shown. There are several small tables of data on a page so I can't use auto filter. The data areas will also change in size as new entries are added. So the last row in the data tables will increase over time. I will copy and apply the macro to each separate table of data.

As an example cell c19 contains "lwsf"

The data table is in the range c24:q47. the column with matching data is column D so all rows of entries with "lwsf" in column D should be visible and the rest hidden. When c19 is changed to "TF" then the rows visible become those with TF in column D and the rest hidden.

View 14 Replies View Related

Use More Than 1 Range Of Cells When Writing A VBA Macro

Nov 18, 2008

Just wanted to know if I could have a range or ranges which are split. The current range i have is N5:AV6. I need to miss out every 6th cell so am looking to do a number of ranges like this - N5:R6, T5:X6, Z5:AD6 etc etc. If this can be done could you show me how I would need to lay it out?

View 2 Replies View Related

Writing A Macro That Deletes Blank Rows

Dec 11, 2008

I need help writing a macro. I only have experience recording them, not writing them in VBA.

I need to check columns A and B for blanks. If A and B are both blank, I want the macro to delete the row and move on to check the next row. I need to perform this macro for the entire worksheet.

View 8 Replies View Related

Writing Macro To Extract Data From Web Page

Mar 17, 2014

As part of a research project i need to extract as much data as possible from a webpage. The problem is to access each table i have to follow lots of links which I can't get to work automatically.

Its from a greyhound-data.com. So an example would be I want to extract all the racing stats for every dog that raced in swindon between 1st jan 2010-1st feb 2010. When i put it in the search engine I get 512 races in a table. I have to follow the link on name of race for each race.. Then I have to follow the link for each dog in the racers box, 6 for each race. Then when i'm on the dogs page theres a link saying on the top of the page saying a nember of races eg. 67races (number will vary for each dog). If I press that I get a list of all the racing stats for that dog. Its that table i need. But i also need the dogs name as a constant column. I need the table for each of the 6 dogs for each race out of the 512.. So in total 3072 tables.. It a lot of data and I have no idea how to get it?!

My biggest problem is I don't know how to say follow the various links. And I don't know how to loop multiple times - once for each of the races in the original list and then for the 6 dogs.

View 4 Replies View Related

Excel 2010 :: Writing Macro To Create Chart?

Feb 12, 2014

I have 6 columns. The 5th and 6th columns are the most important. The 5th contains a figure and the 6th contains a type.

Bascially I am trying to do a basic chart showing the following 2 things. A. Do a percentage chart of column 6 (service) but not of percentage of hoem many lines the product is in. Not based on percentage of how many times Apples are shown compared to other products. I need it to add up everything, then do a percentage of total amounts of oranges and total of for Apples from the figures on column 5. Also, if possible, the pie chart will even show teh actual total figure per product in each (or next to) each pie chart slice.

know the easiest way to do this (step by step) in Excel 2010 and then I can perhaps write a macro for the future?

View 1 Replies View Related

Writing Macro To Grab All Data From Word And Just Paste In Excel

May 8, 2014

I need in XL for a macro to run, open my word file, copy the entire thing and then paste it back in XL.

So leaving it general, Word.doc and Excel.xlsx

It's all because my company's POS system will only export to Word but everything we do is in XL.

View 6 Replies View Related

Writing A "Back" Macro

Dec 3, 2008

I have a series of hyperlinks that take me to named ranges. The named ranges are on different worksheets. Once there, there is no way to get back to the worksheet that hyperlinked me over.

Is there a macro that I can attach to a button that will take me back to the last worksheet? Does Excel record a history? I will hyperlinked from multiple worksheets so it has to link back to the last last worksheet opened prior to hyperlinking.

View 9 Replies View Related

Macro Code To Change Positive Numbers Into Negative Numbers

Feb 1, 2007

I know ASAP has a feature to do this but I need the code in a bigger macro that I wrote.

EX: -1 needs to be 1

View 9 Replies View Related

Macro To Convert Numbers Stored As Text To Numbers?

May 23, 2014

I have been looking through the forums and found the below code, but I have both text and numbers in the same range. I have attached an example of what I need to have converted.

Book1.xlsx

View 3 Replies View Related

Converting Numbers Stored As Text To Numbers Via Macro

Feb 9, 2007

I'm looking for the VBA command for this function. I tried just recording a macro in where I perform the task but it didn't record anything. Tried it several times even.

View 7 Replies View Related

Writing Value 0 In Different Ranges?

Nov 13, 2012

I have a table in which some of the ranges have to be set to "0" (write "0" inside, not delete) when I click on a button. All the other cells expect these ranges are locked. For now I use the very long way, with the following VBA Code:

Range("E7").Select
ActiveCell.FormulaR1C1 = "0"
Selection.AutoFill Destination:=Range("E7:E21"), Type:=xlFillValues

[Code]....

There are more columns for which I have to do that, and it goes until row 500+ .. I used "Register Macro" to find out this code, that's why I guess it's obselete.

Is there any way I can do it, at least write all the ranges I have to fill with "0" next to each other instead of every time selecting, then inserting 0, then autofill the rang with...?

View 9 Replies View Related

Writing A Between Statement

Dec 15, 2006

I have a list of items in a pivot table where each item has a date. I want to see how many items occur for each month. I am trying to use the COUNTIF formula, but I'm having trouble figuring out how to write the criteria for the dates.

How do I write the criteria part to include the entire month?

View 9 Replies View Related

Writing To Word

Sep 25, 2008

if I have another instance of word open my macro will not work correctly. I am at a loss on how to figure this out. Also some times I get the error of virtual machine is not available when getting activedocument.name.

Sub TestTemp()
Application.ScreenUpdating = False

Dim bname as string

bname = Range("B6").Value

Dim WdApp As Object, WdDoc As Object
Set WdApp = CreateObject("Word.Application")
WdApp.Documents.Add "C:TemplatesTest Letter1.dot"
Application.Visible = True
WdApp.Visible = True

AModDoc = ActiveDocument.Name

Documents(AModDoc).Bookmarks("Line1").Range.InsertBefore bname

Application.ScreenUpdating = True
End Sub

View 9 Replies View Related

Writing Subroutine

Oct 27, 2008

in writing a subroutine that needs to ask the user

1) tax file number
2) Income
3) tax withheld

It then needs to use a function that i already made called 'incometax' that calculates 'taxpayable' and use that to calculate taxreturn (difference between 'taxpayable' and 'taxwithheld').

I then need it to output like this in a message box

Estimate for tax file number: .....
Created on ......
Total income: ......
Tax witheld: .......
Tax payable: ......Tax return: .......

View 9 Replies View Related

SelectCase Not Writing Value

Nov 15, 2008

The following code is supposed to write values from one file into another file - depending on the value of Current_Rider_Name. However, although the code runs and values are being picked up (this is checked through the line that is being commented out).

However nothing is being written to the file. Can anybody point me in the right direction? ...

View 9 Replies View Related

Writing An IRR Function In VBA

Aug 16, 2009

way to write your own IRR function using VBA.

Say if I call it Function MYIRR(cfs,per). Where cashflows occur in the periods specified..
i.e
Periods: 0 1 3 4 6
Cashflows: -1000 300 500 100 200

I'm having trouble making sure the initial cash outlay and then cash inflows assumptions hold (problem with the -/+ sign).

I've been told by a friend to try and use abs() function, 'For..Next' loop construct inside a 'Do...While' loop.

View 9 Replies View Related

Writing Udf For If Color Then Else

May 2, 2007

I am trying to write a UDF that will go like this:

IF A1 is Purple then B1=A1 Else B1=A2.

This is what I have written so far and I cannot figure out how to get it to work:

Function SumIfPurple( Range As Variant, Range1, Range2)
Dim SumAnswer
If Range.Interior.ColorIndex = 39 Then
Range1 = SumAnswer
Else: Range2 = SumAnswer
End If
SumIfPurple = SumAnswer

End Function

View 7 Replies View Related

Writing Text In A Cell

Jan 21, 2010

I have a problem, basically im writing in the cell but it keep going along, i want it so when i press enter it creates a new line in the cell, so i can have two lines of text in one cell. do i have to do something in the text settings?

View 2 Replies View Related

Writing In Two Cells One Word?

Apr 22, 2013

I'm trying to write a word or more but i want it to be in different cell.

Like: this sentence "Excel Program" write it in cell a1 but it slip to the cell a2. (so in cell a1 adn a2 this sentence).

View 4 Replies View Related

Writing Formula In Cell Using Vba?

Apr 8, 2014

I have a reference written as a string in cell "AS4", the string is results!A4

I want to write that same reference in cell "as5". I have written the following

[Code] .....

However, cell "as5" returns the string as =results!'A4', with single quotes around A4

Therefore the reference isn't working.

View 2 Replies View Related

Writing Array To Cell

Apr 15, 2009

I'm working on creating an array of letters. I'm then writing that array into a cell. The following code is for writing the letters "ABC" into a cell with an array.

View 4 Replies View Related

Writing ActiveWorkbook Name To A Variable

Nov 17, 2009

I run the macro on a currently open workbook (name could be anything) and open another workbook (name known) and step through the sheets copying various blocks of data across to the first workbook. I need to Activate the 2 workbooks alternatively as I move data back and forth and move from sheet to sheet. What I can't work out is how to determine in code what the "unknown" workbook name is so that I can make sure I activate the right workbook in the code.

I tried Activating the workbook with the "unknown" name and setting a variable = ActiveWorkbook.Name. However the value of this variable changes during the code run when you activate the other book. Is there any way to collect this value and "freeze" it so it won't change as the code runs? At the moment I have got round it by ensuring the "unknown" book is the only one open before I start and refer to it as Workbooks(1) in the code.

View 2 Replies View Related







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