ROW CELLS SHOULD HAVE VALUE WHEN WORKBOOK OPEN
Hi all, I need macro that when i open my Workbook i should have (see
below) in row 2 cells from coloumn A to C cell A2 value = "KK" cell B2 value = "Ford" cell C2 value= "VR" and when i open my workbook again now i should get same thing but in row 3 and it should continue when ever i open my workbook until row 10. And when in row 10 from column A to C i have values in cells A10 , B10 and C10 (the values metioned above) i should not get anything in row 11 and now when ever i'll open my workbook macro should exit . in other words i want macro to put values when ever i open the workbook in each row cells form coloumn A to C and once cell A10 to C10 in row 10 have values now macro should exit and not donot do any thing. I hope i was able to expalin my question. Please can any friend can help |
ROW CELLS SHOULD HAVE VALUE WHEN WORKBOOK OPEN
Hi,
If I've understood correctly, try this. Alt+F11 to open Vb editor. Double click 'This Workbook' and paste this in on the right. Private Sub Workbook_Open() Lastrow = Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row If Lastrow < 10 Then With Sheets("Sheet1") .Range("A" & Lastrow + 1).Value = "KK" .Range("B" & Lastrow + 1).Value = "Ford" .Range("C" & Lastrow + 1).Value = "VR" End With End If End Sub Mike "K" wrote: Hi all, I need macro that when i open my Workbook i should have (see below) in row 2 cells from coloumn A to C cell A2 value = "KK" cell B2 value = "Ford" cell C2 value= "VR" and when i open my workbook again now i should get same thing but in row 3 and it should continue when ever i open my workbook until row 10. And when in row 10 from column A to C i have values in cells A10 , B10 and C10 (the values metioned above) i should not get anything in row 11 and now when ever i'll open my workbook macro should exit . in other words i want macro to put values when ever i open the workbook in each row cells form coloumn A to C and once cell A10 to C10 in row 10 have values now macro should exit and not donot do any thing. I hope i was able to expalin my question. Please can any friend can help |
ROW CELLS SHOULD HAVE VALUE WHEN WORKBOOK OPEN
On 9 Aug, 11:29, Mike H wrote:
Hi, If I've understood correctly, try this. Alt+F11 to open Vb editor. Double click 'This Workbook' and paste this in on the right. Private Sub Workbook_Open() Lastrow = Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row If Lastrow < 10 Then * * * * With Sheets("Sheet1") * * * * * * .Range("A" & Lastrow + 1).Value = "KK" * * * * * * .Range("B" & Lastrow + 1).Value = "Ford" * * * * * * .Range("C" & Lastrow + 1).Value = "VR" * * * * End With End If End Sub Mike "K" wrote: Hi all, I need macro that when i open my Workbook i should have (see below) in row 2 cells from coloumn A to C cell A2 value = "KK" cell B2 value = "Ford" cell C2 value= "VR" and when i open my workbook again now i should get same thing but in row 3 and it should continue when ever i open my workbook until row 10. And when in row 10 from column A to C i have values in cells A10 , B10 and C10 (the values metioned above) i should not get anything in row 11 and now when ever i'll open my workbook macro should exit . *in other words i want macro to put values when ever i open the workbook in each row cells form coloumn A to C and once cell A10 to C10 in row 10 have values now macro should exit and not donot do any thing. *I hope i was able to expalin my question. *Please can any friend can help- Hide quoted text - - Show quoted text - Yes this is what i was looking for. Thanks Mike H |
ROW CELLS SHOULD HAVE VALUE WHEN WORKBOOK OPEN
Just for the archive, here is a slightly different way to do the same
thing... Private Sub Workbook_Open() Dim EmptyRow As Long With Sheets("Sheet1") EmptyRow = .Cells(Rows.Count, "A").End(xlUp).Row + 1 If EmptyRow <= 10 Then .Range("A" & EmptyRow).Resize(1, 3).Value = Array("KK", "Ford", "VR") End If End With End Sub Rick "K" wrote in message ... Hi all, I need macro that when i open my Workbook i should have (see below) in row 2 cells from coloumn A to C cell A2 value = "KK" cell B2 value = "Ford" cell C2 value= "VR" and when i open my workbook again now i should get same thing but in row 3 and it should continue when ever i open my workbook until row 10. And when in row 10 from column A to C i have values in cells A10 , B10 and C10 (the values metioned above) i should not get anything in row 11 and now when ever i'll open my workbook macro should exit . in other words i want macro to put values when ever i open the workbook in each row cells form coloumn A to C and once cell A10 to C10 in row 10 have values now macro should exit and not donot do any thing. I hope i was able to expalin my question. Please can any friend can help |
All times are GMT +1. The time now is 03:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com