Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Add worksheet

Hello, Merry Christmas to you and a happy new year.

I am trying to add a worksheet template to a workbook if and when it is
needed. I don't seem to be able to get it right.
I cycle through about 12 rows on the first sheet, then 24 on the 2nd.
The 2nd sheet is identicle to the template i want to add. There may be
a far easier method here.
I would like to add the sheet when i've got to the end of sheet2, name
that sheet 3, 4 or 5? and put it to the end.

So far i've magaged this, but something's not right.

Private Sub Image11_Click()
N = N + 2
If N 47 And sht = 1 Then
sht = 2: N = 6
ElseIf N 52 And sht = 2 Then
sht = sht + 1: N = 6
End If

If Sheets.Count sht And N = 52 Then
Call Addsht
Else

End If
Label19.Caption = Sheets("Sheet" & sht).Cells(N, 1)
Call getinf

End Sub

Thanks for looking
CAA


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default Add worksheet

If N 47 And sht = 1 Then
sht = 2: N = 6
ElseIf N 52 And sht = 2 Then
sht = sht + 1: N = 6
End If


You will never get to the "ElseIf N 52" since the previously specified
condition "N 47" p will already be met.

Perhaps you want the first condition to be "N 47 And N <= 52" ?

HTH,
Shockley


"CAA" wrote in message
...
Hello, Merry Christmas to you and a happy new year.

I am trying to add a worksheet template to a workbook if and when it is
needed. I don't seem to be able to get it right.
I cycle through about 12 rows on the first sheet, then 24 on the 2nd.
The 2nd sheet is identicle to the template i want to add. There may be
a far easier method here.
I would like to add the sheet when i've got to the end of sheet2, name
that sheet 3, 4 or 5? and put it to the end.

So far i've magaged this, but something's not right.

Private Sub Image11_Click()
N = N + 2
If N 47 And sht = 1 Then
sht = 2: N = 6
ElseIf N 52 And sht = 2 Then
sht = sht + 1: N = 6
End If

If Sheets.Count sht And N = 52 Then
Call Addsht
Else

End If
Label19.Caption = Sheets("Sheet" & sht).Cells(N, 1)
Call getinf

End Sub

Thanks for looking
CAA


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Add worksheet

Shockley,

The previous condition is If N47 AND sht = 1
The ElseIf will be executed if sht = 2 (or more) even if N is 47.

HTH
Henry

"shockley" wrote in message
...
If N 47 And sht = 1 Then
sht = 2: N = 6
ElseIf N 52 And sht = 2 Then
sht = sht + 1: N = 6
End If


You will never get to the "ElseIf N 52" since the previously specified
condition "N 47" p will already be met.

Perhaps you want the first condition to be "N 47 And N <= 52" ?

HTH,
Shockley


"CAA" wrote in message
...
Hello, Merry Christmas to you and a happy new year.

I am trying to add a worksheet template to a workbook if and when it is
needed. I don't seem to be able to get it right.
I cycle through about 12 rows on the first sheet, then 24 on the 2nd.
The 2nd sheet is identicle to the template i want to add. There may be
a far easier method here.
I would like to add the sheet when i've got to the end of sheet2, name
that sheet 3, 4 or 5? and put it to the end.

So far i've magaged this, but something's not right.

Private Sub Image11_Click()
N = N + 2
If N 47 And sht = 1 Then
sht = 2: N = 6
ElseIf N 52 And sht = 2 Then
sht = sht + 1: N = 6
End If

If Sheets.Count sht And N = 52 Then
Call Addsht
Else

End If
Label19.Caption = Sheets("Sheet" & sht).Cells(N, 1)
Call getinf

End Sub

Thanks for looking
CAA


---
Message posted from http://www.ExcelForum.com/





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default Add worksheet

Henry, thanks for catching that!

Regards,
Shockley


"Henry" wrote in message
...
Shockley,

The previous condition is If N47 AND sht = 1
The ElseIf will be executed if sht = 2 (or more) even if N is 47.

HTH
Henry

"shockley" wrote in message
...
If N 47 And sht = 1 Then
sht = 2: N = 6
ElseIf N 52 And sht = 2 Then
sht = sht + 1: N = 6
End If


You will never get to the "ElseIf N 52" since the previously specified
condition "N 47" p will already be met.

Perhaps you want the first condition to be "N 47 And N <= 52" ?

HTH,
Shockley


"CAA" wrote in message
...
Hello, Merry Christmas to you and a happy new year.

I am trying to add a worksheet template to a workbook if and when it

is
needed. I don't seem to be able to get it right.
I cycle through about 12 rows on the first sheet, then 24 on the 2nd.
The 2nd sheet is identicle to the template i want to add. There may be
a far easier method here.
I would like to add the sheet when i've got to the end of sheet2, name
that sheet 3, 4 or 5? and put it to the end.

So far i've magaged this, but something's not right.

Private Sub Image11_Click()
N = N + 2
If N 47 And sht = 1 Then
sht = 2: N = 6
ElseIf N 52 And sht = 2 Then
sht = sht + 1: N = 6
End If

If Sheets.Count sht And N = 52 Then
Call Addsht
Else

End If
Label19.Caption = Sheets("Sheet" & sht).Cells(N, 1)
Call getinf

End Sub

Thanks for looking
CAA


---
Message posted from http://www.ExcelForum.com/








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
automatically appending newly added data on worksheet to a master list worksheet tabylee via OfficeKB.com Links and Linking in Excel 0 December 17th 09 04:24 PM
Unable to Insert Worksheet/Move and copy worksheet Excel 2003 lukerush Excel Worksheet Functions 2 September 7th 06 05:05 PM
Upload multiple text files into 1 excel worksheet + put the filename as the first column in the worksheet Aster Excel Worksheet Functions 3 March 12th 06 09:58 AM
I want in one worksheet to relatively link to/reference cells in another without changing the format of the current worksheet. [email protected] Excel Discussion (Misc queries) 0 September 22nd 05 04:39 PM
Attaching a JET database to an Excel Worksheet OR storing large binary data in a worksheet Ant Waters Excel Programming 1 September 3rd 03 11:34 AM


All times are GMT +1. The time now is 08:05 AM.

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"