Combining Two Lines Of Code
Jun 14, 2007I have two lines of code which I want to consolidate into 1. for example
Sheets("Snapshot").Select
Range("A1").Select
I've tried combining but get errors.
can they be combined
I have two lines of code which I want to consolidate into 1. for example
Sheets("Snapshot").Select
Range("A1").Select
I've tried combining but get errors.
can they be combined
I'm having trouble combining three lines into one. I'm trying to do a daily weight chart and the x-axis is days of month, and the y-axis is the weight. I have 3 rows for the weight (one red line for weight going up from previous day, one green if the weight goes down from previous day, and one yellow line for equal). I want to make the three into one showing the colors. Right now all they are are vertical lines and are not connected.
View 9 Replies View RelatedI have a report that I ran that gives me all the customer we have. Unfortunately, my system gives me a separate line item for any thing that my be different within the account like the account has multiple services. I need a way through excel or vba to take these multiple rows of the same acct # and site # and combine it into one line. Each account and site could have multiple services so I would need each consecutive service to be moved to last empty cell of the first such account.
View 11 Replies View Relatedin column A i have account name but it can be up to 4 lines (rows)
in column B i have the fund name which goes with the first account name row
so...
I receive a monthly report containing a list of people, and how much is being paid for certain services. The company that sends me this list is preparing to adjust their rates and it will be retroactive back a few months.
The way they plan on doing it is by means of taking a credit back several months, then "re-paying" the correct rate. The main data will include the month for which the payment (or credit) is being made, the person's unique identifier, as well as the amount.
Here's a sample of what it would look like:
Name, ID, Month, Amount
John Doe, 123, 04012008, 25.00
John Doe, 123, 03012008, -20.00
John Doe, 123, 03012008, 25.00
John Doe, 123, 02012008, -20.00
John Doe, 123, 02012008, 25.00
So basically the above shows they paid $25.00 (correct rate) for April 08, then they took back $20.00 the prior two months (the old rate) and paid the correct rate right afterwards.
In what I need to do, this is going to be a lot of work. Is there a way to programatically merge the amounts given the member's unique ID as the "key field" as well as the same month? So it might look like the following:
Name, ID, Month, Amount
John Doe, 123, 04012008, 25.00
John Doe, 123, 03012008, 5.00
John Doe, 123, 02012008, 5.00
Just giving the sum of the amounts for a the given people in the same month?
I'm pretty good with VBA but this one is stumping me.
I have two different bits of code as follows:
View 3 Replies View RelatedHave created a userform for people to use to populate a spreadsheet and based upon the values filled in cells, and date segregators, formulae determine whether the line of data is classified as new / increased or reduced.
Obviously I can sort this in excel quite easily by this criteria.
At the moment it is about 500 rows deep,and is sorted by N/I/R.....
What I ideally want to be able to do is create 3 new worksheets, N/I/R and then select all the N's and bung them in sheet N, row 2, and then repeat selecting all I and then all R, and pasting in respective sheets.........
Obviously it can be done, but I am far too rusty to do this.
At the moment, all is sorted in one worksheet, alpha ascending...
My excel program on my home computer has a default number format so that when I type in a number such as "1", the spreadsheet displays 1E-20. If I enter the number as "1.0", the display will show correctly. I have tried changing the formats for the spreadsheet, but I still cannot get the program to work correctly. I tried reinstalling office, but nothing changed.
View 6 Replies View RelatedCode:
Sub Final()
Dim NameCell As Range
For Each NameCell In Sheets("! Names").Range("B1", Sheets("! Names").Cells(Rows.Count, "B").End(xlUp))
[Code]....
I want to pull data from ! Names. This code already Renames a new sheet from the ! Names sheet and also puts there name in cell C2 and phone number into cell C3 of the created sheet. I want to put more data from the ! Names sheet. How would i go about adjusting current code to do that?
I've written a piece of code that is so long, I have to use the scroll bar to see the whole of it, which isn't very user friendly
if there's a way of splitting long lines of code over say 2 or 3 lines, so I can read the whole thing without having to use the scroll bar? I've noticed some people use _ at the end of the code and then continue writing on the next line, but when I do this, I get an error message saying
"Compile Error : Expected : line number or label or statement or end of statement"
I have spreadsheet application which have a ton of sheets and macro into it, and i work on devlop and program it , and add new feature and codes
i wana Module_Macro to find and replace lines of vba code and replace it with lines of codes .
i know ,i should use vbide and vbcompnent , but i dont know from where to start ?
I stumbled on this and wasn't sure why the code was placed on different lines and how the highlighted sections in red affect the basic round function.
ColorCompare = Round( _
(111111 + Blue + Red + Green) / (Green + LenPaint) _
, 0 _
)
I received assistance from NBVC for combining data from two cells. Post http://www.excelforum.com/showthread.php?p=2135144. I need to convert the formula into macro code. I thought I would be able to convert it on my own, but running into some troubles with run time errors. Here is the Excel formula, which is working fine.
View 5 Replies View RelatedAdding ' in the beginning of a line converts the rest into comment line. I wonder if there is an easy way to convert a huge area into comment line to try something on code. I couldn't find such an option in the menu.
View 2 Replies View Relatedcreating breaks in the line this script now simply turns the line black.
View 9 Replies View RelatedI use excel 2002 but some of my office are on 97, i want to add a small workbook open event code which works for me but debugs for the others?? The code is basically, go to a tab, on that tab and that range sort..
View 2 Replies View RelatedI've developed a little software using Excel Macros & VB. To prevent people from accesing the code I protected the code blocking it from visualization. It seems not enough as an acquaintance of a friend cracked it in 25 minutes. Or so he says. So I'd like to know if there is a better way to protect the font code.
View 8 Replies View RelatedI have some code where I use and statements, as follows:
View 4 Replies View RelatedI want to see if a goal has been met and get a "Yes" or "No" so I wrote
=If(A1>=A2),"Yes","No"
But on months not worked where goal and production both equal 0 then I am getting a return of Yes. How can I say is A1 >= to A2, but if both are 0 return N/A?
I am having problems combining AND and OR into a single statement. To start I have a statement =IF(AND(B978="P",R978=0,S978=0),"processed",""). If B=P and R=blank and S=blank then display PROCEED else make blank.
What I want to do is check if S is blank or "N" but when I try to add an OR I get error messages regarding missings )'s =IF(AND(B978="P",R978=0,OR(S978=0,S978="N"),"processed","").
I have two vba the first one records the date & time of a cell change in column a and places this in column b
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("a:a")) Is Nothing Then
Target.Offset(0, 1) = Date & " " & Time
End If
End Sub
The second one is a function to get the User logged in to windows.
Function UNameWindows() As String
UNameWindows = Environ("USERNAME")
End Function
What I really could do with is a way of incorporating the user name in the first function so it records date, time and user?
I have two seperate columns, First Name (Column B) and Last Name (Column C). Is there a way a macro can combine the two into one cell Last Name, First Name.
View 3 Replies View RelatedI am trying to write a UDF function where I lookup if a value is on a range on different sheet. I would like to be able to write what I want the result to be in the function. I also hard coded that the function need 3 range and 3 results, but I know it is possible the make the number of component vary depending on what the user writes. I would like my function to do that.
Here is what I have written so far :
VB:
Function find_para2(var As String, rng As Range, result1 As String, rng2 As Range, result2 As String, rng3 As Range, result3 As String)
If WorksheetFunction.IsNA(WorksheetFunction.VLookup(var, rng.Address, 1, False)) = False Then
find_para = find_para & result1 & ", "
[Code] .....
I need to find a formula to show the time allowed for each person, now they recomend combining 'if' with 'lookup'. now I may be having a blonde moment but I have tried to figure it out for a while now and i am stuck.
View 14 Replies View RelatedTrying to combine Column A (First Name) with Column B (Last Name) Probably very simple.!
View 2 Replies View RelatedI have a big amount of data and want to consolidate it.
I have identical text in Columns 1,3 and 4, but the text in Column 2 is different for all.
How do I make 1 row instead of 3 with Column 2 consolidated?
See the attachment : Excel_list.xlsx
I have a problem in excel that is very urgent to resolve. I have a table that contains duplicate records e.g two people living at same address. I want to merge those records whose address field value is same. Find attached an excel sheet that contains the exact data and the exact output that I want. I know it requires VBA coding.
View 4 Replies View Relatedok - I have numbers that need to be converted to 12-digit numbers with leading zeros if they are less than twelve digits. for example, 1234567 would turn into 000001234567 to have 12 digits. to do this, i use:
=rept(0,12-LEN(A1))&A1
additionally, i need to strip off the last three digits and replace them with three zeros. my example would now become 000001234000. assuming the result of my first formula (above) is in cell B1, i would use:
=INT(B1/1000)&"000"
Is there a way to combine these two functions into one formula to make this conversion process more painless? Or is there another formula/function I can use that I haven't thought of or do not know?
I'm having a mental block here. I need the below statement to have a max value of (B14*B4) in the instance where
(B17-B19)*0.7 exceeds (B14*B4),
IF(B17-B19
I got 2 macros that I want to run in one go. So to explain:
Here is the data of Sheet1 before the macro is run:
A
B
C
D
E
[Code]....
Keep in mind, when Macro2 is run it puts the data on Column W then X then Y etc as soon as the Column reaches 20 it moves on to the next one.
So my question is:
Is there anyway to combine both macros to just run it once instead of running it individually?