Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default referring to worksheets by name in a vba fourier transform

Hello. I was trying to call a fourier transform from vba and refer to the
worksheet the input data was on using a string variable. Here's the code:

Application.Run "ATPVBAEN.XLA!Fourier", sheetindex.Range("M15:M1038"),
sheetindex.Range("O15:O1037"), False, False

where sheetindex is a string type variable containing the name of the
worksheet. The following code works if the data is on sheet1:

Application.Run "ATPVBAEN.XLA!Fourier", sheet1.Range("M15:M1038"),
sheet1.Range("O15:O1037"), False, False

I get an error which says "invalid qualifier". I also tried setting the
active worksheet to the worksheet named by the string type variable and then
writing Activeworksheet.range to try and get the range right, but that didn't
work either. Any help would be greatly appreciated,

Jackson
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default referring to worksheets by name in a vba fourier transform

Your confusion arises because Sheet1 is the worksheet name as well as the
object itself. To use the worksheet name, you need to use something like:

Worksheets("sheetindex").Range("M15:M1038")


"JacksonRJones" wrote in message
...
Hello. I was trying to call a fourier transform from vba and refer to the
worksheet the input data was on using a string variable. Here's the code:

Application.Run "ATPVBAEN.XLA!Fourier", sheetindex.Range("M15:M1038"),
sheetindex.Range("O15:O1037"), False, False

where sheetindex is a string type variable containing the name of the
worksheet. The following code works if the data is on sheet1:

Application.Run "ATPVBAEN.XLA!Fourier", sheet1.Range("M15:M1038"),
sheet1.Range("O15:O1037"), False, False

I get an error which says "invalid qualifier". I also tried setting the
active worksheet to the worksheet named by the string type variable and
then
writing Activeworksheet.range to try and get the range right, but that
didn't
work either. Any help would be greatly appreciated,

Jackson



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default referring to worksheets by name in a vba fourier transform

<Worksheets("sheetindex").Range("M15:M1038")

Probably without the quotes around sheetindex

--
Kind regards,

Niek Otten

"Vasant Nanavati" <vasantn AT aol DOT com wrote in message ...
Your confusion arises because Sheet1 is the worksheet name as well as the object itself. To use the worksheet name, you need to
use something like:

Worksheets("sheetindex").Range("M15:M1038")


"JacksonRJones" wrote in message
...
Hello. I was trying to call a fourier transform from vba and refer to the
worksheet the input data was on using a string variable. Here's the code:

Application.Run "ATPVBAEN.XLA!Fourier", sheetindex.Range("M15:M1038"),
sheetindex.Range("O15:O1037"), False, False

where sheetindex is a string type variable containing the name of the
worksheet. The following code works if the data is on sheet1:

Application.Run "ATPVBAEN.XLA!Fourier", sheet1.Range("M15:M1038"),
sheet1.Range("O15:O1037"), False, False

I get an error which says "invalid qualifier". I also tried setting the
active worksheet to the worksheet named by the string type variable and then
writing Activeworksheet.range to try and get the range right, but that didn't
work either. Any help would be greatly appreciated,

Jackson





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default referring to worksheets by name in a vba fourier transform

Thanks, Niek; my mistake.

Regards,

Vasant

"Niek Otten" wrote in message
...
<Worksheets("sheetindex").Range("M15:M1038")

Probably without the quotes around sheetindex

--
Kind regards,

Niek Otten

"Vasant Nanavati" <vasantn AT aol DOT com wrote in message
...
Your confusion arises because Sheet1 is the worksheet name as well as the
object itself. To use the worksheet name, you need to use something like:

Worksheets("sheetindex").Range("M15:M1038")


"JacksonRJones" wrote in
message ...
Hello. I was trying to call a fourier transform from vba and refer to
the
worksheet the input data was on using a string variable. Here's the
code:

Application.Run "ATPVBAEN.XLA!Fourier", sheetindex.Range("M15:M1038"),
sheetindex.Range("O15:O1037"), False, False

where sheetindex is a string type variable containing the name of the
worksheet. The following code works if the data is on sheet1:

Application.Run "ATPVBAEN.XLA!Fourier", sheet1.Range("M15:M1038"),
sheet1.Range("O15:O1037"), False, False

I get an error which says "invalid qualifier". I also tried setting the
active worksheet to the worksheet named by the string type variable and
then
writing Activeworksheet.range to try and get the range right, but that
didn't
work either. Any help would be greatly appreciated,

Jackson







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default referring to worksheets by name in a vba fourier transform

Here's a general outline of something I use when working with Fourier
Analysis.
Note the use of " Worksheets(Sht)" where Sht is the name of the worksheet.

Sub Demo()
'// Dana DeLouis
Dim Sht As String
Dim DataIn, DataOut
Dim n, t

'// Functions He
Const FFT As String = "ATPVBAEN.XLA!Fourier"

'// Your string
Sht = "Sheet1"

Set DataIn = Worksheets(Sht).Range("M15:M1038")
Set DataOut = Worksheets(Sht).Range("O15")

'// Quick Check of input size...
n = DataIn.Cells.Count
t = Round(Log(n) / Log(2), 10)

If t - Int(t) < 0 Then
MsgBox "Wrong size of input..." & n
Exit Sub
End If

'// FFT Bug...Clear Output first
DataOut.Resize(n, 1).ClearContents
Run FFT, DataIn, DataOut
End Sub

--
HTH. :)
Dana DeLouis
Windows XP, Office 2003


"JacksonRJones" wrote in message
...
Hello. I was trying to call a fourier transform from vba and refer to the
worksheet the input data was on using a string variable. Here's the code:

Application.Run "ATPVBAEN.XLA!Fourier", sheetindex.Range("M15:M1038"),
sheetindex.Range("O15:O1037"), False, False

where sheetindex is a string type variable containing the name of the
worksheet. The following code works if the data is on sheet1:

Application.Run "ATPVBAEN.XLA!Fourier", sheet1.Range("M15:M1038"),
sheet1.Range("O15:O1037"), False, False

I get an error which says "invalid qualifier". I also tried setting the
active worksheet to the worksheet named by the string type variable and
then
writing Activeworksheet.range to try and get the range right, but that
didn't
work either. Any help would be greatly appreciated,

Jackson





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
Analysis ToolPaks VBA Fast Fourier Transform Dimitry Excel Discussion (Misc queries) 7 April 30th 23 03:44 AM
how to fourier/laplace transform a time signal? Movie Maker Excel Worksheet Functions 1 November 28th 07 05:26 PM
Fast Fourier Transform outputs in Excel custardcream13 Excel Worksheet Functions 1 September 12th 07 05:20 AM
Fast Fourier Transform Ad Pronk Excel Worksheet Functions 0 May 12th 05 11:38 AM
MS Excel Fourier Transform Wordgeek Excel Discussion (Misc queries) 1 November 30th 04 05:37 PM


All times are GMT +1. The time now is 11:23 PM.

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

About Us

"It's about Microsoft Excel"