Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Another Db Question? Adding Sheets


how do i add new tables to a mdb database and then alter the fields?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Adding && Naming Sheets
Hi,

I'm having trouble finding examples or explanations of code that will let me: check if a workbook file exists, preferably by matching file names to the contents of a text box (e.g. a user enters "MyFile.xls" in the box & hits my command button - among other things, the macro would refer to that box & then look for "MyFile.xls" in a specific folder or drive) if it doesn't, create one & then add named sheets to it if it does, add a new sheet to it & give that sheet a sequential name (e.g. "page 4" which comes after "page 3") then save the results of the macro to that sheet
I've figured out how to do pieces of it, but can't seem to get them to fit together. Can anyone here help me?

Here's my cobbled together attempt, altho I know it isn't correct & doesn't work:

Code:
Sub AddResultstoNewSheet() 'Test to see if a Workbook exists + to add new Sheets containing macro results
For b = 1 To iNumSubsamples
ReDim DataSetsArr(1 To iNumSubsamples, 1 To iNumPopulations, 1 To iNumFields)
ResultsTitle = "Subsamples for G vs " & b ‘but I can’t understand how this’d be saved to the new sheets
Dim i As Integer
With Application.FileSearch
.LookIn = "C:My Documents"
.Filename = "MyResults.xls"
If .Execute > 0 Then 'Workbook exists
Workbooks.Open "c:My DocumentsMyResults.xls"
Dim ResultsSheet As Worksheet ‘adds a sheet to a pre-existing workbook
Dim iSheetCount As Integer
iSheetCount = Sheets.Count
Set ResultsSheet = Sheets.Add()
ResultsSheet.Name = "Page " & CStr(iSheetCount + 1)
Else
Dim NewBk As Workbook ‘to add a new workbook
Set NewBk = Workbooks.Add
Application.DisplayAlerts = False
NewBk.SaveAs Filename:= "c:My DocumentsMyResults.xls"
Workbooks.Open "c:My DocumentsMyResults.xls"
Dim ResultsSheet As Worksheet ‘adds a sheet to a pre-existing workbook
Dim iSheetCount As Integer
iSheetCount = Sheets.Count
Set ResultsSheet = Sheets.Add()
ResultsSheet.Name = "Page " & CStr(iSheetCount + 1)
End If
End Sub
Pleeeeeeeaaaaaase help me - I'm drowning in an incomprehensible coding nightmare...
Thanks!!

Adding && Naming Sheets
Hi,

I'm having trouble finding examples or explanations of code that will let me:

check if a workbook file exists, preferably by matching file names to the contents of a text box (e.g. a user enters "MyFile.xls" in the box & hits my command button - among other things, the macro would refer to that box & then look for "MyFile.xls" in a specific folder or drive)
if it doesn't, create one & then add named sheets to it
if it does, add a new sheet to it & give that sheet a sequential name (e.g. "page 4" which comes after "page 3")
then save the results of the macro to that sheet


I've figured out how to do pieces of it, but can't seem to get them to fit together. Can anyone here help me?

Here's my cobbled together attempt, altho I know it isn't correct & doesn't work:

Code:Sub AddResultstoNewSheet() 'Test to see if a Workbook exists + to add new Sheets containing macro results
For b = 1 To iNumSubsamples
  ReDim DataSetsArr(1 To iNumSubsamples, 1 To iNumPopulations, 1 To iNumFields)
  ResultsTitle = "Subsamples for G vs " & b ‘but I can’t understand how this’d be saved to the new sheets
Dim i As Integer
    With Application.FileSearch
        .LookIn = "C:My Documents"
        .Filename = "MyResults.xls"
               If .Execute > 0 Then 'Workbook exists
        Workbooks.Open "c:My DocumentsMyResults.xls"
          Dim ResultsSheet As Worksheet ‘adds a sheet to a pre-existing workbook
          Dim iSheetCount As Integer
         iSheetCount = Sheets.Count
             Set ResultsSheet = Sheets.Add()
          ResultsSheet.Name = "Page " & CStr(iSheetCount + 1)
         Else
        Dim NewBk As Workbook ‘to add a new workbook
        Set NewBk = Workbooks.Add
         Application.DisplayAlerts = False
        NewBk.SaveAs Filename:= "c:My DocumentsMyResults.xls"
            Workbooks.Open "c:My DocumentsMyResults.xls"
              Dim ResultsSheet As Worksheet ‘adds a sheet to a pre-existing workbook
              Dim iSheetCount As Integer
             iSheetCount = Sheets.Count
                 Set ResultsSheet = Sheets.Add()
              ResultsSheet.Name = "Page " & CStr(iSheetCount + 1)
    End If
End Sub
Pleeeeeeeaaaaaase help me - I'm drowning in an incomprehensible coding nightmare...
Thanks!!

Adding Excel Sheets Programmatically
How can I do this and how many can I add?

Focus And Adding Sheets With VB And Excel
My code works correctly except I need to select or focus on the next sheet
Thanks in advance !


Dim oExcel As Excel.Application
Dim oWB As Excel.Workbook
Dim oWS As Excel.Worksheet
Dim icols
Set oExcel = New Excel.Application
'oExcel.Visible = True ' <-- *** Optional ***
oExcel.DisplayAlerts = False
oExcel.AlertBeforeOverwriting = False
Set oWB = oExcel.Workbooks.Add
Set oWS = oWB.Worksheets("Sheet1")

'This is Sheet1

For icols = 0 To UDMA.Recordset.Fields.Count - 1
oWS.Cells(1, icols + 1).Value = UDMA.Recordset.Fields(icols).Name
Next
oWS.Range(oWS.Cells(1, 1), _
oWS.Cells(1, UDMA.Recordset.Fields.Count)).Font.Bold = True
oWS.Range("A2").CopyFromRecordset UDMA.Recordset
oWS.Rows("1:11").Select
oWS.Columns.AutoFit
oWS.Select
oWS.Name = "UDMA"

'Need to select or focus on Sheet2 here for the following code.


For icols = 0 To Flpy_Disk_Smk.Recordset.Fields.Count - 1
oWS.Cells(1, icols + 1).Value = Flpy_Disk_Smk.Recordset.Fields(icols).Name
Next
oWS.Range(oWS.Cells(1, 1), _
oWS.Cells(1, Flpy_Disk_Smk.Recordset.Fields.Count)).Font.Bold = True
oWS.Range("A2").CopyFromRecordset Flpy_Disk_Smk.Recordset
oWS.Columns.AutoFit
oWS.Select
oWS.Name = "Disk&Flpy"

'Need to add a Sheet here for the following code.

For icols = 0 To MassStorage.Recordset.Fields.Count - 1
oWS.Cells(1, icols + 1).Value = MassStorage.Recordset.Fields(icols).Name
Next
oWS.Range(oWS.Cells(1, 1), _
oWS.Cells(1, MassStorage.Recordset.Fields.Count)).Font.Bold = True
oWS.Range("A2").CopyFromRecordset MassStorage.Recordset
oWS.Columns.AutoFit
oWS.Select
oWS.Name = "MassStorage"

'Need to add another Sheet here for more code to follow.


Searched here already but only could find how to copy sheets.
Thanks in advance !

Compare 2 Sheets And Extract Common And Error Rows Into Another Sheets
Hope someone can help this poor newbie!

Allow me to explain.

I have a Excel Work Book with 2 Sheets named Caller(100 rows)and Subscriber(500 rows).
Caller contains 2 columns: one is audio file name(with .au extension)
and other is the content in that audio file.
Subscriber also contains 2 columns: one is audio file name(with .au extension)
and other is the content in that audio file.

Now what I wish to do is to compare Caller and Subscriber and:
To remove the common rows from Caller and Subscriber and place them in sheet3.
To remove the rows if it satisfies any of the following error conditions and place them in sheet4:
i)if any .au extension is missing in the column1 in both sheets
ii)if data in column1 is same and data in column2 is different
iii)if data in column2 is same and data in column1 is different.

I am herewith attaching the code I was able to prepare but not able to get the exact output.

Many thanks in advance.

With Regards,
Rajesh

Hide Sheets/objects, Save, Unhide Sheets/Objects
There was another post about this recently. I have pieced my code together with that and the help doc. here is what I got.


Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim strCurrentSheet As String
strCurrentSheet = ActiveSheet.Name
With Application
.ScreenUpdating = False
.EnableEvents = False
End With

If Hidden_Elements_Hidden = False Then Call Hidden_Elements_Hide
If SaveAsUI Then ThisWorkbook.SaveAs Application.GetSaveAsFilename Else ThisWorkbook.Save
If Hidden_Elements_Hidden = True Then Call Hidden_Elements_Show
Sheets(strCurrentSheet).Activate

'NOTE THIS LINE
Cancel = True

With Application
.ScreenUpdating = True
.EnableEvents = True
End With
Workbooks(ThisWorkbook.Name).Saved = True

End Sub
This works fine if I manually save the workbook and then manually close it.
Although, if I just goto close the following happens. I get the save changes prompt. After it saves, I get that same prompt again.

Any Ideas?

Edit:
Is there a way to test if the document is closing in the beforesave event?

3D Sum Across All Sheets?
Sometimes, the limitations of the Search Engine in here can be frustrating.

I'm attempting to do a 3D sum across all sheets but the first one. All sheets will be of the same format, but the first sheet will be a "Totals" type sheet.

I've been playing with the Indirect function, but I keep getting errors instead of values.

28 Sheets
How can the enduser insert data into one userform that would only populate the current active sheet? I have over 28 sheets which are forms and would like the enduser to use only one userform....the information the enduser would insert utilize the same cells on all 28 sheets so what code would I use that would enable the enduser the same freedom of an assigned control source?

Typically the control source would be used (Sheet1!A1) if
I were dealing with one sheet. Not sure how to write the
code that would let the enduser populate the active sheet
from a userform

Your help and suggestions are always appreciated.

Character Sheets?
Im making a character creation program for AD&D and Im a little stuck here, trying to get character sheets to print out.

What would be the best way to print out sheets? Use a database program like access or to create a form, or with a pre-drawn character sheet stuck in its own borderless form and a bunch of labels that would input values over the correct spaces...(wow that is messy)

Right now im using PrintForm, lol.

any suggestions?

Comparing 2 Sheets...
Okay, here's my situation.

one.xls -> Sheet1

two.xls -> Sheet2

I have information in Sheet1 a ton of unique serial numbers.

Sheet 2 has my inventory that I need to check off...

What I would like to do is in Sheet1, all of the serial numbers are in Column A, then in Column B, I want it to say Okay or Missing when it compares itself to Column A in Sheet 2... So if Serial #: 1A2B3C is missing from sheet 2 I will find out if it's not counted for in the inventory... There a way I can do this? Thanks.

Excel Sheets In Vb
How can I add Excel in VB? or use math functions in excel using VB?

Thxs

Delete Sheets
How can I open an existing excel document and, if there are more than 3 worksheets in the document, delete the extra sheets?

Selected Sheets
hey i am trying to do something based on selected sheets in a excel workbook, what im trying to do is take the sheet name thats active when the form loads and assign it to variable

If ?? = "Agents" Then
sheet = "Agents"
ElseIf ?? = "off profile" Then
sheet = "off profile"

something similar to that with "Agents" and "off profile" as the sheet names. Anyone know?

Sheets.protect ????
Hello,

At work i am making a protected sheet, i use some macro's on the sheet, but if i protect the sheet, the macro's will not work

normally this is no problem, just tell the macro to unprotect the sheet.
But i entered a password when i protected the sheet, and now the macro's can not unprotect the sheet annymore, how can i change my macro to be able to unprotect the sheet and still protect my sheet with a password??

Please help

Referring To Sheets
Sorry if this has been questioned before. I wasn't able to find an answer thru the search feature. Since I don't know the correct terms in english(software is in portuguese), I will try to define my situation as best as possible. I have an Excel "file"(?): padrao.xls in which I have one sheet(?) called "GERAL". I'm creating 4 new sheets in padrao.xls that will be feed with data from "GERAL". My question is how to refer to one sheet or another using the Cells method(it's a method?), be it do something like that:
Sheet(1).Cells(1,2) = Sheet(5).Cells(3,7)
I know I can refer to them by the internal name(in portuguese Plan1, Plan2, etc) but these names are different every time I create the sheets making them useless for me. I also can use the Sheets(3) or Sheets("GERAL") references buit not with the Cells method. Any idea would be greatly apreciated as my company has a very crappy and slow support team wich can't install the office on-line Help in time
I hope I did myself fairly clear in what I need. Again thanks in advance...

Excel Sheets
Is there a way to find a sheet by it's name without looping through all the sheets?? I.E.

workbook.sheets("sheet1")

instead of using
workbook.sheets(1)

Search 10 Sheets For Just 1
Can anyone help me with this:

I would like to make a new sheet and create a form which can search 10 sheets i have and return the sheet with the correct data on.

eg. The user types in my form the ID of the persons data they would like to view. When they click the command button it returns the results on the current sheet or takes them stright to the correct sheet?

thanks in advance

Sheets.delete
Using Excel and VBA6...


Code:
If Searched = True Then
Sheets("SearchResults").Delete
End If

Basically after the first run I set searched to true. If the user clicks the same button again, I want the sheet deleted. However, the very first time we come in here I get subscript out of range b/c the SearchResults sheet isn't there yet. How can I get around this? It shouldn't even be in there b/c the first time around Searched is False. Anyone????

Thanks.

Add A New Worksheet Between Other Sheets
G'day all,

I have code worked out so that a new sheet can be created from a form input, then for the new sheet to be pre-filled with the format and formulae required.

The worksheets are divided into two categories (Service A and Service B). Where I am stuck is that I do not know how to add the sheet into the correct group. Currently, I have the following sheets:Main Data (all employees, pay rates, tax levels)Service A (no data in this sheet - just used as a divider)Employee 1Employee 2, etcService B (no data in this sheet - just used as a divider)Employee 1Employee 2, etcI want to be able to add, for example, an employee to Service B, then to re-sort the sheets in Service B alphabetically. Any help you can give me will be greatly appreciated, even if it is only in the form of key-words that I can use to search this forum (I have tried to do a search, but the words being used for the search return many, many hits that have nothing to do with the question).

My initial thoughts were to find or assign the sheet numbers in the workbook, then find the sheet numbers for Service A and Service B, then use the relevant number+1 of where to add the sheet, then to sort the relevant sheet numbers. I just need some help with putting this into code.

Thanking you in advance,

Mitchy

Looping Through Sheets
Hello...

Simple...except for me... trying to loop through sheets until an empty one is discovered and then paste...

Here is the code I'm trying...but not working


Code:
Dim sh As Sheets
For Each sh In ActiveWorkbook
If ActiveSheet.[A3] = "" Then _
ActiveSheet.Paste
Next

If ActiveSheet.[A3] <> "" Then _
Msg = MsgBox("All Sheets In This Workbook Are Full", vbOKOnly, "ERROR DETECTED")
Exit Sub

Thanks!

Excel Sheets
I put my data in the database in a format in Excel sheets to be given to the customer. The Excel file starts off with three sheets named Sheet1,Sheet2,Sheet3. How do I make it start off with one Excel sheet.

Please help

Regards

Varrey

Counting Sheets
I am trying to open a workbook and count the sheets. Not too hard, right? Apparently I'm being an idiot. Here's the code:


Code:
fName = Application.GetOpenFilename
Workbooks.Open Filename:=fName
sCount = Workbooks(fName).Worksheets.Count

I get a subscript out of range error on the 3rd line. I have also tried Sheets.Count and I've tried selecting the workbook and saying Activeworkbook.Sheets.Count, etc. but I keep getting the same error.

Thanks

Extra/less Sheets
we us excel/vb.net to generate about 50 excel documents every day. these documents contain sheets from 5 to as much as 12 sheets. on the development machine every thing seems to work fine, but when the program is deployed on the server then some times the program creates more or sometimes less sheets then that a expected. can any one pleae help me here

oho, can mods please move it to the .net office automation area

Fillacross Sheets
Hello people, i am using visual basic 5 and somebody probably can solve the problem quickly.

i want to fill across a number of sheets, i can do it with vba in excel,but not in VB 5. the problem is the bit at the end where is says "type" (see below,sample code). I have tried many things but it tells me that (type as xlfillwith=xlfillwithall). i tried this and get the same problem as below.

i have tried excel.xlfillwith.xlfillwithall then it asks me that i need "expected =" and then expected expression. but i don't know what the expression is, can any body help what to type in where it say "type".

***appexcel= excel.application

the rest of the sample code:

AppExcel.Range("B1:y1").Select ' this select the range
AppExcel.Selection.Copy
AppExcel.Sheets(Array("sheet1", "sheet2", "sheet3", "sheet4", "sheet5", "sheet6", _
"sheet7", "sheet8", "sheet9", "sheet10", "sheet11", "sheet12", "sheet13", "sheet14", _
"sheet15", "sheet16", "sheet17", "sheet18")).Select
'the aboce selects the sheet

AppExcel.Sheets("sheet1").Activate

AppExcel.ActiveWindow.SelectedSheets.FillAcrossSheets(appexcel.Range(" b1:y1"),type
' the problem is what do i typr in"type" above

this bit works in VBA but not in VB5 it as for expected expression

AppExcel.ActiveWindow.SelectedSheets.FillAcrossSheets Range:=Selection, Type:=xlAll

Average Over Several Sheets
Visual Basic 6.0 w/MS Excel

I have a workbook with three sheets. The names of the sheets are Test1, Test2 and Test3.
At the same cell address on each sheet there are values that I wish to find the average and standard deviation.
For example, at cell address B4 on each sheet are the following values:

Test1 – 2
Test2 – 9
Test3 – 4

I know that if I use the following formula in a macro I can get the average value of 5:


Code:
Activecell.FormulaR1C1 = "=Average(‘Test1’!B4,’Test2’!B4,’Test3’!B4)"
Here’s my question. The above example uses three sheets. Is there a general statement that I can include in a macro that covers the case for finding the average having N sheets in a workbook?

Dealing With Sheets
Hello!

I put code in a AddIn, to work with data in sheets.
Everythink works well, but I need a help in control. I can I control the sheets, to know if I can Apply the rotine or not. I need some way to identify the workbook sheets, everytime I start the rotine.

Imagine, some one can try to apply the VBA o AddIn in a Invalid sheet...
The results can be a big problem.

I control the sheets with a object and with the respective name. Ex: set ws(1)= SheetName.

I can I validate the file, when I try to run the code ???

Thanks

Sumif , Between To Sheets
tried to insert the Sumif function in sheet3's column2 to sum the cells in sheet2's column2, comparing with the match between the cells in sheet2's,column1 with sheet3's column1.
it's mean if data in sheet's2 column1 george,john,jeny,george,jeny - column2 ,2,4,5,4,8
and the data in sheet3's column1 has the same data .Sumif function will show the result (of sum the number in sheet2's column2) in the sheet3's column2 .


Code:
Private Sub CommandButton1_Click()
Dim cell As Range, cel As Range
Set myRange3 = Worksheets(2).Range("A1:A100")
Set myRange4 = Worksheets(2).Range("b1:b100")
For Each cell In myRange3
For Each cel In Sheets(3).Range("a1:a100")
If cel.Value = cell.Value And cell.Value <> "" Then
cel.Offset(0, 1).Value = "=SUMIF(Sheet2!A1:a100," & cell.Address & ",Sheet2!B1:b100)"
End If
Next
Next
End Sub
The Sumif doesn't work well .

Worksheet_BeforeRightClick For All Sheets?
Between this board (great board BTW) and the VBA help files I have managed to pick up VBA failrly quickly in the last few months. However, I am really stumped on this problem.

I have a small sub that checks the cell a user right clicks on to see if the cell references another sheet in the workbook. If so, I add a custom menu item to the top of the shortcut menu so they can "drilldown" to the source cell on the other sheet.

Works fine, however, I am going nuts trying to figure out how to catch the right click event without putting the Worksheet_BeforeRightClick event in every sheet (there are over 400 sheets in the file). Putting the sub in ThisWorkbook doesn't catch the event. I can't find a WorkBook event for right click events. Any help is greatly appreciated. Thx.

Consolidating All Sheets Into One.
First of all, I would like to say "thank you" once again to Herilane for the help you offered in my topic about copying and pasting ranges. Everything worked out beautifully.

Second, I would like to ask a new question that sort of goes along with my old one.

I have seen quite a few examples on the web explaining how to use VBE to copy all information from a set of worksheets, and paste it all together on one worksheet. This would be a great idea for the contracts that I am working on. However, each of my worksheets has very different column widths and formatting. So, I had this thought instead: Is there any way to somehow print out all of the worksheets, and have one worksheet start printing where the last worksheet stopped? In other words, instead of having multiple printed pages that only have one or two rows on them, is there any way to have the next worksheet in the array start printing at the point on the page where the last worksheet stopped? I don't really know if I am making any sense, and I don't hold out much hope for a solution to this question, but I know if there is a solution, this is the place to find it.

We are using Microsoft Excel 2000 on some of the computers that will be using this workbook, and we are using Microsoft Excel XP on a few of the other computers.

Detecting Sheets
Hello, i need a script that will detect whether a sheet called "Chart1" exists.

I tried the followingscript:

Private Sub CommandButton1_Click()

If Sheets("Chart1").Select Then
Pasdrint = MsgBox("Chart has been found")
Else
Pasdrint = MsgBox("Could not find the chart")
End If
End Sub


The only troublewith this script is:

If the sheet "Chart1" Exists it brings the message Chart has been found
If the sheet "Chart1" does NOT exists it brings up an error saying

"Subscript Out of range"

and then it tries to debug. Olbviously the method i tried does not work, does anybody know any way to get a script to do this for me?

Delete Sheets Except Specified One
I have a workbook with about 130 sheets, and I want to delete all of them except 3 with certain names?

Also, is it possible to do a search for a sheet using the * wldcard function, then select all with the partial name?

Ta

D.

Delete Sheets
Hi, i think this could be a very simple question, i need to delete all the sheets of a workbook except the first.
I've got a software that generate this workbook with more than one sheet, but im going to use only the first sheet because the other contain no data.
Do you have any idea to make this process.
Thank you,
bye.
Francesco

Get Data From Other Sheets
I have a workbooks that contains several worksheets like order confirmations, accessories,etc. when in Order confirmations sheets, I need to key-in accessories data, so I created a button to show accessories sheets that allow me to select the data that I want.
My problem is how to do in macro, show the accessories sheets in Order Confirmations sheets then select the data that I select from the accessories will auto fit into Order confirmations sheets.

sorry for my less knowledge in this.

Unvisible Sheets
I have a workbook that contain 3 sheets, as "Home","ABC","123"
"Home" sheet is Main Menu. How to write macro in vb if "HOME" sheets is active, the "ABC" & "123" sheets will be hidden. If I select to visible "ABC" sheets from Main Menu then the "ABC" sheet will be visible.

Work With Sheets
Hi,
i post here my problem in the hope someone can help me !
I need to read a sequence of sheet in a workbook, but i would like to do it without to know the name of the sheet and if it would be possible i'd like to count the sheet.
I need this because i have to execute the same macro in different workbook that have a different number of sheets with different names.
Thank you all.

Wil Not Apply To All Sheets
I'm pretty new to this so again it's probably a really simple mistake. I am trying to apply the followong fortmatting to all sheets in a workbook. I started out with this.


Code:
Dim shtTemp As Worksheet
For Each shtTemp In ActiveWorkbook.Worksheets
With shtTemp

ActiveWindow.Zoom = 85
Range("C8").Select
ActiveWindow.FreezePanes = True
ActiveSheet.PageSetup.PrintTitleRows = "$1:$7"
ActiveSheet.PageSetup.PrintTitleColumns = "$A:$B"
ActiveSheet.PageSetup.Orientation = xlLandscape
ActiveSheet.PageSetup.Zoom = 85
ActiveSheet.PageSetup.LeftMargin = Application.InchesToPoints(0.4)
ActiveSheet.PageSetup.RightMargin = Application.InchesToPoints(0.4)
ActiveSheet.PageSetup.TopMargin = Application.InchesToPoints(0.5)
ActiveSheet.PageSetup.BottomMargin = Application.InchesToPoints(0.5)
ActiveSheet.PageSetup.HeaderMargin = Application.InchesToPoints(0.5)
ActiveSheet.PageSetup.FooterMargin = Application.InchesToPoints(0.5)
End With

Next

However for some reason it only applied to the first sheet so I added in the next sheet command at the end of the loop.
Code:
activesheet.next.select
This works but obviously when it has formatted all the sheets it cannot find another and returns an error.

How can I either get the top code to work properly or make it stop at the last sheet?

Thanks for you help

Hidden Sheets
How do you create and delete a new sheet through code? Also, how would you Use code to copy and paste columns into the new sheet from existing sheets?

Save Sheets
I'm looking for how to make code that saves selected, or predefinded sheets form current workbook into a new workbook.

Rename Sheets
Hi,

I am new to VBA and need some help on a code. This is a last ditch resort and hope someone will be able to kindly share some knowledge with me.

I have a spreadsheet with around 30 sheets and I need to rename them all based on names I have in one "data" sheet. Eg cell A1 will contain the original sheet name eg "sheet1" and cell A2 will be what I want to rename the sheet eg "profituk".

Is there an easy bit of code I can write to do such a task.

As you can see my knowledge is minimal - any help is greatly appreciated,

Regards,

Pateja

How To Know If Two Sheets Are Identical
Hi,
Is there a way to know if two sheets from the same workbook are identical?
TIA
Huub

SubData Sheets
I got a subdata sheet accessing a table with items.
I have items already in the table but when I open the sub data sheet from the table the sub data sheet is attached to, no records show up.

I created a relationship between the two tables One to Many

Table 1
Fields: Name Phone Item
John Smith 111-1111

Table 2 (Sub datasheet of Table 1)
Field:Item
Radio

Relationship is Table2 === Table1 Item and Item


My second problem is I have a 3rd Table that I am trying to use as a Inner Join of Table 1 and 2. The user picks an Item from the Sub Data sheet and that selection is saved as a new record in Table 3 along with the information from Table 1.

Is this possible ?

Name Of Excel's Sheets
Hi
I have a textbox in which the user enters the full path of an Excel file,on lost focus of the textbox, I want to populate a listbox containing the name of the Sheets inside this excel file

Any help?
thanks

Add Sheets In Excel
I would like to be able to add sheets to excel in VBA, and name the sheets according to the cells in column A, as a new value is entered in column A ,a new sheet will be added with that new values name for the sheet.. maybe through a worksheet change event,
Has anybody have a code like this?

Writing In Two Sheets
hello,

how to write in two different sheets of excel from one application of vb simuntaneously...can anybody plz tell something so that i can proceed...

thanks,
nitin

How Do I Use Excel Sheets Using Vb?
hello,

How do I use excel sheets using vb?
I want to add data, remove data, sort it, search it, and do other stuff...

how can I do that using vb code?

thanks

Copy Sheets
Hi All,

I have this code below that opens and views a .xls doc which contains one sheet, what I am trying to do is to count how many items are in my listview if there is 3 copy that first sheet and create 2 more sheets how can I do this?

Thanks

Loftty


VB Code:
Set oWB = oApp.Workbooks.Open(App.path & " estdoc2.xls")oWB.ActivateoApp.Visible = TrueFor i = 1 To ListView3.ListItems.Count Step 1 Next

Multiple Sheets In CSV
Hi,

I am using the following code in VB6 to generate a CSV file that opens in MS EXCEL :

CODE :

Dim printLINE as String
Dim ctr as Integer
Open "c:File1.CSV" For Output As #1
For ctr = 0 To 20
printLINE = printLINE & ctr & ","
next ctr
Print #1, printLINE

This generates a csv file by the name File1.csv with only one sheet by the name File1.

My question is that how can i have more that one sheet e.g. File1 & File2 within the same csv file File1.CSV?

Does any body have any idea ?

Arun

Excel Sheets And VB
I have activated the worksheet that i am trying to get to in Excel. However, VB will recognize the default worksheet and will not read any values from the activated worksheet. All the worksheets are located in the same workbook. Code is as below:

Workbooks(lateruse).Sheets(excelinfo3).Activate
'Later Use is the C:/ Filename** 'EXCELINFO3 is the SHEET NAME'
ActiveWorkbook.Worksheets(excelinfo3).Activate

'EXAMPLE DO FOR LOOP TO SEE IF VB SEES NEW SHEET
Do Until InStr(Excel1.Cells(row, col), "Group")
a = Excel1.Cells(col, row).Value
row = row + 1
Loop
'EXCEL RETURNS DEFAULT SHEET VALUES

HELP!!

Thanks in advance!!
~Jason

Excel Sheets
Is it possible to open a workbook whit only one sheet?

Copyright © 2005-08 www.BigResource.com, All rights reserved