LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formula SheetName Syntax

<--
Ok. Here's the deal.

I have a procedure that when I press a button creates a worksheet, copy
the format from a template sheet and changes the sheet name to a user
assigned client number entered on a field in a form. It also add a line
to a general list of client on another worksheet. The problem resides
on this sheet. I need to copy a formula but I'm not sure on the correct
syntax. This is the procedu
--

Private Sub btnNewSupplier_Click()

Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("SupplierList") // This is the general list

iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

ws.Cells(iRow, 1).Value = Me.SupplierName.Value
ws.Cells(iRow, 2).Value = Me.SegSocNo.Value
ws.Cells(iRow, 3).Value = Me.Address.Value
ws.Cells(iRow, 4).Value = Me.City.Value
ws.Cells(iRow, 5).Value = Me.State.Value
ws.Cells(iRow, 6).Value = Me.ZipCode.Value
ws.Cells(iRow, 9).Value = Me.cbo480.Value

<--
This is the formula I want to copy:

=SUMPRODUCT(('[SheetName]'!D2:D101=Cover!D11)*('[SheetName]!D2:D101<=Cover!D12)*'[SheetName]'!E2:E101)

The formula brings a total between two dates in two cells in a sheet
named "Cover".
--


Sheets("Formato").Select // This is the new sheet
Range("A1:F1").Copy
Sheets.Add
ActiveSheet.Paste
ActiveSheet.Name = Me.SegSocNo
ActiveSheet.Move After:=Worksheets(Worksheets.Count)
Columns("A:A").Select
Selection.ColumnWidth = 15.29
Columns("B:B").Select
Selection.ColumnWidth = 46.86
Columns("C:C").Select
Selection.ColumnWidth = 15.57
Columns("D:D").Select
Selection.ColumnWidth = 15.29
Columns("E:E").Select
Selection.ColumnWidth = 14.86
Columns("F:F").Select
Selection.ColumnWidth = 16.86
Application.GoTo Sheets("Portada").Range("A1"), True

SupplierName.Value = ""
Address.Value = ""
City.Value = ""
State.Value = "PR"
ZipCode.Value = ""
cbo480.Value = ""
SegSocNo.Value = ""


End Sub

<--
Now my question is: Since the sheet name isn't assigned until the
copying procedure ends, what's the correct syntax to refer to the newly
created sheet?
---

 
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 update SheetName in workbook sub if SheetName changes [email protected] Excel Discussion (Misc queries) 3 February 29th 08 04:33 PM
Reference Sheetname in Formula JMay Excel Discussion (Misc queries) 6 March 10th 07 02:05 PM
Sheetname formula John S Excel Worksheet Functions 3 December 5th 06 07:34 PM
Formula that returns the sheetname TimT Excel Discussion (Misc queries) 2 September 8th 05 04:33 PM
How do I have a formula lookup a sheetname? Mim Excel Worksheet Functions 2 February 1st 05 03:49 PM


All times are GMT +1. The time now is 03:22 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"