Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I posted this earlier but received no response so I'm hoping to have better
luck this time. I have a possible of 300 rows of data on sheet2 (this is variable but no more than 300). Column A on sheet2 is currently blank. The data starts in column B of sheet2 and is the result of an "IF" type formula. What I need the code to do is starting with row 2 on sheet2, look for data in B2. If the result of the "IF" statement in B2 results in a blank cell for B2, then go to the next row and repeat for row 3. If there is data in B2, copy the data in a cell from a different worksheet (sheet1 $C$4) into this cell and then continue on to row 3. I think I have explained it sufficiently so any help would be greatly appreciated. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jun 4, 3:21*pm, Jeff Gross
wrote: I posted this earlier but received no response so I'm hoping to have better luck this time. I have a possible of 300 rows of data on sheet2 (this is variable but no more than 300). *Column A on sheet2 is currently blank. *The data starts in column B of sheet2 and is the result of an "IF" type formula. What I need the code to do is starting with row 2 on sheet2, look for data in B2. *If *the result of the "IF" statement in B2 results in a blank cell for B2, then go to the next row and repeat for row 3. *If there is data in B2, copy the data in a cell from a different worksheet (sheet1 $C$4) into this cell and then continue on to row 3. I think I have explained it sufficiently so any help would be greatly appreciated. Sub CopyMacro() Dim X As Integer For X = 2 To 301 If Sheet2.Cells(X, 2).Value < "" Then Sheet2.Cells(X, 2).Value = Sheet1.Cells(4, 3).Value End If Next X End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the help. One last question...
How do I reference the worksheets if the names are changed to something like "Sheet Data 1" and "Sheet Data 2"? Jeff "Jennifer" wrote: On Jun 4, 3:21 pm, Jeff Gross wrote: I posted this earlier but received no response so I'm hoping to have better luck this time. I have a possible of 300 rows of data on sheet2 (this is variable but no more than 300). Column A on sheet2 is currently blank. The data starts in column B of sheet2 and is the result of an "IF" type formula. What I need the code to do is starting with row 2 on sheet2, look for data in B2. If the result of the "IF" statement in B2 results in a blank cell for B2, then go to the next row and repeat for row 3. If there is data in B2, copy the data in a cell from a different worksheet (sheet1 $C$4) into this cell and then continue on to row 3. I think I have explained it sufficiently so any help would be greatly appreciated. Sub CopyMacro() Dim X As Integer For X = 2 To 301 If Sheet2.Cells(X, 2).Value < "" Then Sheet2.Cells(X, 2).Value = Sheet1.Cells(4, 3).Value End If Next X End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Jennifer but I figured it out. I changed the code to :
Sub CopyMacro() Dim X As Integer For X = 2 To 301 If Worksheets(7).Cells(X, 2).Value < "" Then Worksheets(7).Cells(X, 1).Value = Worksheets(2).Cells(4, 3).Value End If Next X End Sub It does exactly what I needed - thanks again. Jeff "Jennifer" wrote: On Jun 4, 3:21 pm, Jeff Gross wrote: I posted this earlier but received no response so I'm hoping to have better luck this time. I have a possible of 300 rows of data on sheet2 (this is variable but no more than 300). Column A on sheet2 is currently blank. The data starts in column B of sheet2 and is the result of an "IF" type formula. What I need the code to do is starting with row 2 on sheet2, look for data in B2. If the result of the "IF" statement in B2 results in a blank cell for B2, then go to the next row and repeat for row 3. If there is data in B2, copy the data in a cell from a different worksheet (sheet1 $C$4) into this cell and then continue on to row 3. I think I have explained it sufficiently so any help would be greatly appreciated. Sub CopyMacro() Dim X As Integer For X = 2 To 301 If Sheet2.Cells(X, 2).Value < "" Then Sheet2.Cells(X, 2).Value = Sheet1.Cells(4, 3).Value End If Next X End Sub |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jun 4, 3:21*pm, Jeff Gross
wrote: I posted this earlier but received no response so I'm hoping to have better luck this time. I have a possible of 300 rows of data on sheet2 (this is variable but no more than 300). *Column A on sheet2 is currently blank. *The data starts in column B of sheet2 and is the result of an "IF" type formula. What I need the code to do is starting with row 2 on sheet2, look for data in B2. *If *the result of the "IF" statement in B2 results in a blank cell for B2, then go to the next row and repeat for row 3. *If there is data in B2, copy the data in a cell from a different worksheet (sheet1 $C$4) into this cell and then continue on to row 3. I think I have explained it sufficiently so any help would be greatly appreciated. Sub CopyMacro() Dim X As Integer For X = 2 To 301 If Sheet2.Cells(X, 2).Value < "" Then Sheet2.Cells(X, 2).Value = Sheet1.Cells(4, 3).Value End If Next X End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy & paste worksheet with print settings into new worksheet | Excel Discussion (Misc queries) | |||
Copy data from one worksheet and paste into another worksheet | Excel Programming | |||
Copy & paste cells fr open worksheet then close the worksheet | Excel Programming | |||
excel 97: copy and paste values from one worksheet to another worksheet | Excel Programming | |||
excel 97: copy and paste values from one worksheet to another worksheet | Excel Programming |