Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 557
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 557
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to: Open closed workbook/Search data tables/Return data to open workbook Hugh Adams Excel Discussion (Misc queries) 0 August 18th 10 02:04 PM
Open a workbook, Copy several cells, then Close the previously openedworkbook [email protected] Excel Worksheet Functions 0 April 9th 08 11:54 PM
Open a specific workbook...find value from other open workbook and then insert cells values in cell next to it. [email protected] Excel Programming 1 May 13th 07 01:46 PM
using a workbook to open more workbooks with filenames stored in cells [email protected] Excel Programming 5 January 16th 07 04:49 PM
Unlock cells in other open workbook Steph[_6_] Excel Programming 1 November 7th 05 05:44 PM


All times are GMT +1. The time now is 05:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"