Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I would need help to "translate" one thing in VBA code. In fact i have to diiferent columns in a excell sheet: Column A: each row represents a week day in 2008: Column B: must have a value related for each day; Example: Column A: 01/01/2008 Column B: 2.95 Column A: 02/01/2008 Column B: 2.96 Column A: 03/01/2008 Column B: 2.97 Column A: 04/01/2008 Column B: 2.98 When writing this on VBA code i´m doing like this: Range("b1").select Activecell.formular1c1="2.95" Range("b2").select Activecell.formular1c1="2.96" Range("b3").select Activecell.formular1c1="2.97" Range("b4").select Activecell.formular1c1="2.98" Is there a way to make it easier? Thank you for your help. jimmy |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe this
lastrow = Cells(Rows.Count, "A").End(xlUp).Row Range("B1").Value = 2.95 Range("B2").Value = 2.96 Range("B1:B2").AutoFill Destination:=Range("B1:B" & lastrow) Mike "jimmy" wrote: Hello, I would need help to "translate" one thing in VBA code. In fact i have to diiferent columns in a excell sheet: Column A: each row represents a week day in 2008: Column B: must have a value related for each day; Example: Column A: 01/01/2008 Column B: 2.95 Column A: 02/01/2008 Column B: 2.96 Column A: 03/01/2008 Column B: 2.97 Column A: 04/01/2008 Column B: 2.98 When writing this on VBA code i´m doing like this: Range("b1").select Activecell.formular1c1="2.95" Range("b2").select Activecell.formular1c1="2.96" Range("b3").select Activecell.formular1c1="2.97" Range("b4").select Activecell.formular1c1="2.98" Is there a way to make it easier? Thank you for your help. jimmy |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hello Mike,
Thanks for your answer. In fact, and i do not now if this is possible, what i pretend to do is have the values of column b recorded also in VBA code. Everyday i set a new value in column b (which corresponds to the value for that day) in the excel sheet. Is it possible to do that in vba code but avoiding always select and activate the column as i told you? Does it make any sense? "Mike H" escreveu: Maybe this lastrow = Cells(Rows.Count, "A").End(xlUp).Row Range("B1").Value = 2.95 Range("B2").Value = 2.96 Range("B1:B2").AutoFill Destination:=Range("B1:B" & lastrow) Mike "jimmy" wrote: Hello, I would need help to "translate" one thing in VBA code. In fact i have to diiferent columns in a excell sheet: Column A: each row represents a week day in 2008: Column B: must have a value related for each day; Example: Column A: 01/01/2008 Column B: 2.95 Column A: 02/01/2008 Column B: 2.96 Column A: 03/01/2008 Column B: 2.97 Column A: 04/01/2008 Column B: 2.98 When writing this on VBA code i´m doing like this: Range("b1").select Activecell.formular1c1="2.95" Range("b2").select Activecell.formular1c1="2.96" Range("b3").select Activecell.formular1c1="2.97" Range("b4").select Activecell.formular1c1="2.98" Is there a way to make it easier? Thank you for your help. jimmy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using formula in code | Excel Programming | |||
Selecting all records from one text file wright to another | Excel Programming | |||
Selecting all records from one text file wright to another | Excel Programming | |||
Add formula in the code | Excel Programming | |||
Help with code or formula | Excel Programming |