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




.Name Sheet


Hello!

How can I make this:

Workbooks("cogs.xls").Worksheets("sheet1").Activate

using the internal .name property of the sheet and not the "name" of sheet




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Coping A Formatted Sheet To Another Sheet: Problem With Hidden Rows
Ciao Gurus,

I have to copy an excel sheet with hidden rows to another sheet but the hidden rows are shown in the second sheet.
What or how can do?




 

How To Copy Data From One Sheet And Paste In A Sheet In Multiple Workbooks
I'm pretty new to excel vba and I have a macro that I'm working where the goal is to copy the date out of one sheet and past it in another sheet but in multiple workbooks in a folder. Any help would be appreciated. Thank you.

Sub Copy()
Application.EnableEvents = False
Application.DisplayAlerts = False
Dim i As Long
Dim sFolder As String
Dim fldr As Object
Dim FSO As Object
Dim Folder As Object
Dim file As Object
Dim Files As Object
Dim this As Workbook
Dim cnt As Long


    Set FSO = CreateObject("Scripting.FileSystemObject")


    Set this = ActiveWorkbook
    sFolder = "My Folder"
    If sFolder <> "" Then
        Set Folder = FSO.GetFolder(sFolder)


        Set Files = Folder.Files
        cnt = 1
        For Each file In Files
            If file.Type = "Microsoft Excel Worksheet" Then
                Workbooks.Open Filename:=file.Path
                With ActiveWindow
                    Range("A1:T12005").Select
                Selection.Copy
                With ActiveWorksheet
                    Sheets("Sheet 1").Activate
                Range("A1").Select
                ActiveSheet.Paste
                Selection.Interior.ColorIndex = xlNone
                ActiveWorkbook.Close SaveChanges:=True
                End With
                cnt = cnt + 1
                End If
                Next file

    End If ' sFolder <> ""

Application.EnableEvents = True
Application.DisplayAlerts = True
End Sub

Please post in the approriate sections of the site. This post has been moved to the VBA section from VBCity News





Edited by - vikramjb on 8/10/2006 10:01:31 PM

Concating Data Of More Than One Excel Sheet To One Sheet In The Same Work Book
Dear

I want to concate data of sheets in to another sheet in the same work book through VB.Please help me

Calculate Sheet Automatically Triggered By Sheet Activation
I am trying to automatically calculate a sheet when it is activated. Due to the slow speed of calculation (due to its size) of my excel spreadsheet I have turned calculation to manual. I have tried the following without success.

What am I doing wrong


Private Sub SheetActivate(ByVal Sh As Object)
Sh.Calculate
End Sub

How To Create A Macro To Copy Information In One Sheet To Another Sheet.
Hi All,
I was wondering how I can create a Macro to copy information that is on Sheet1 to SHeet2. The kink is that it only should copy the information in Column A when for example column C has a cell in it saying "YES". Please let me know at your earliest convience.

Thank You.
Mark

VB In Excel - Trying To Display Cells From Sheet To Sheet.
I'm going to go ahead and appologize for asking this, but I have no idea where to even start to search.

What I am trying to do is run and excel macro that will look for an specific enrty in column A. The entry it is searching for can happen multiple times. I want it to then display the information in columns B-F, respective to the the criteria in column A. (If the search is met in column A, that row I want displayed on a new sheet within the workbook)

I'm pretty sure that I can get info to display from one sheet to another. But my problem is how to run the loop so that it will search column A, and dipslay all respective information in columns B-F, if their column A meets the criteria. And stop when it gets to the bottom of the data, obviously.

Any help is so much appreciated. Also if you could just refer me to another section/topic, that will work too. Thanks in advance.

-g2

One Excel Sheet Monitoring Another Sheet's Events
I've written some macros that open an excel workbook and when an account number is typed into a user defined cell or cells the name associated with that account number is plugged into another user defined cell from the workbook the macros opened. I think my co-workers would find these macros very useful, the problem is none of them are very computer literate, and I don't want to have to go around and set these macros up on their excel workbooks. I would like to have these macros stored in a single sheet, but be triggered by the events of the sheets created by my co-workers without them having to insert any code into the sheets they create... just insert the sheet with the macros. Does anybody know if this is possible?? I appreciate any of the help I can get!!! I'm getting frustrated!!!

Copy Date From Sheet And Rename Sheet
Hi All,
I need help with a macro in excel. I thought I had it all working except for one thing. Every evening excel will open and run the macro. I am inserting a new sheet every day and renameing with that days date. My problem is when I recorded the macro the line of code that names the sheet inserted the days date that I recorded the macro. See below:
Sheets("Sheet2").Name = "2003 2 19"
How do I change the above line so that it will reference cells b3:d3 to rename my sheet.
Thanks.

Activating Code On One Sheet From A Button On Another Sheet.
I have a string of code that behaves exactly as I want it to on Sheet 1 of my workbook (Excel 02). Now, I want to excecute this code via a button on Sheet 2 of my workbook. I know this is probably simple, but I haven't found a solution. Here's the code:


Quote:




Private Sub CommandButton1_Click()
Dim varAnswer As String

varAnswer = MsgBox("This cannot be undone." & Chr(10) & Chr(10) & "Edits to this workbook my only be entered into your Data Sheet manually once the current data is compiled.", vbOKCancel)
If varAnswer = vbCancel Then
Exit Sub
End If
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 2
EndRow = 21
For Lrow = EndRow To StartRow Step -1
If IsError(.Cells(Lrow, "a").Value) Then
'Do nothing, This avoid a error if there is a error in the cell

ElseIf .Cells(Lrow, "A").Value <= " " Then .Rows(Lrow).Delete
'This will delete the row if the cell is empty

End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With

Range("A2:m21").Select
Selection.copy

End Sub




Thanks in advance.

Tring To Find Items On One Sheet On Another Sheet, Then Ect..............
Code:Private Sub cmdCompleted_Click()
    Dim strProjects
    Dim c
    Dim firstAddress
    Dim Count1
        
    strProjects = lstProjects.List(lstProjects.ListIndex)
    
    With Worksheets("Job Location and Status").Range("a1:a500")
        Set c = .Find(strProjects, LookIn:=xlValues)
        If Not c Is Nothing Then
            firstAddress = c.Address
            Do
                c.Interior.Pattern = xlPatternGray50
                Set c = .FindNext(c)
            Loop While Not c Is Nothing And c.Address <> firstAddress
        End If
    End With
    
End Sub

The code above will find the selected line (from a list box that is on one sheet) on "Job Location and Status" and the A# cell gray. (I have been piecing this code together from the F1 button.) What I want it to do is find like it does, but instead of doing something with the matching cell, I want it to change a cell in the same row. EX. If it finds that cell A7 matches, I want to place a value in C7.

Does this make sense?

Thanks

Linking Rows From Sheet To Sheet Within A Workbook ?
Hello all
           I am trying to make a workbook easier to use. The workbook has 4 different worksheets & over 200 rows, each row is a different project. At the moment I have click buttons to change from sheet to sheet

on sheet 1 row 10 is one project, sheet's 2,3 & 4 row 10 contain information relating to the same project. Is it possible to wright some code that will link the rows form one sheet to the next and it bring the active row to the top of the page.

thanks for your help
        Tom

Need VB Code To Insert A Row For A Subscripted Line In Excel & Code To Search For Amounts On One Sheet And Apply Them To Certain Area On Another Sheet
I am in the process of developing an Excel spreadsheet and need assistance
in adding visual basic code to automate it.

The first thing I am trying to do is to create a macro where a user can
click on a certain button, and the program will insert a row at a specific
row and will copy all formulas associated with the row above it. For
instance, if you have a spreadsheet that has 10 rows and 3 columns in it,
you can insert a subscript line below row 5 and call it 5.1. When the
subscripted row "5.1" is added, it will include the same formulas as in row
5, which would add columns 1 and 2 in column 3.

The second thing I am trying to do is have some code that if a user enters
information on Sheet B that needs to also be included on Sheet A, the code
will search Sheet B to see it an entry made on Sheet B should be carried to
a particular row in Sheet A.

I would greatly appreciate any feedback anyone can give me regarding this.
Thanks in advance.

Rename A Sheet And Sheet Properties
Simple on but I cannot figure it out, thanks in advance

I have software the exports products to excel and the file name is date.xls and the sheet name is a random number. what i need to do is rename the sheet, sheet1 and the properties(name) to sheet1. I then need to add another sheet, sheet2 and the name the properties(name) to sheet2.

I just cannot get it to rename the sheet properties(name). I have looked through the web and cannot find how to do it.

thanks

Prevent Add Sheet If The Sheet Is Already Exits
I have a macro that will add sheets (costing,T&A,order confirmations) into activeworkbooks (marketing.xls). If the sheets (costing (2), T&A (2),order confirmations (2)) are already exits, then will prompt user a msg, if not will create the sheets for them.
but when I run the macro, there will created 8 set of the three sheets.
pls help...


For Each ws In ActiveWorkbook.Worksheets
If ws.Name Like "Costing (2)" Then
MsgBox "You must save your current costing before create another costing"
Else
Worksheets("Costing").Visible = True
Worksheets("T&A").Visible = True
Worksheets("Order Confirmations").Visible = True

Sheets(Array("Costing", "T&A", "Order Confirmations")).Select
Sheets("Order Confirmations").Activate
Sheets(Array("Costing", "T&A", "Order Confirmations")).Copy Before:=Workbooks( _
"Marketing.xls").Sheets(2)
End If
Next ws

Worksheets("Costing").Visible = xlVeryHidden
Worksheets("T&A").Visible = xlVeryHidden
Worksheets("Order Confirmations").Visible = xlVeryHidden

Hide Sheet In Sheet List
I use a little procedure to create a pop-up worksheet selector. There are a couple of sheets that I would like left out of the list. Can anyone help edit this snippet.

Code:
Set OriginalSheet = ActiveSheet
ShtCnt = ActiveWorkbook.Sheets.Count
ReDim SheetData(1 To ShtCnt, 1 To 1)
ShtNum = 1
For Each sht In ActiveWorkbook.Sheets
If sht.Name = ActiveSheet.Name Then _
ListPos = ShtNum - 1
SheetData(ShtNum, 1) = sht.Name
ShtNum = ShtNum + 1
Next sht
With ListBox1
.ColumnWidths = "100 pt;50 pt"
.List = SheetData
.ListIndex = ListPos
End With
Set OriginalSheet = ActiveSheet
ShtCnt = ActiveWorkbook.Sheets.Count
ReDim SheetData(1 To ShtCnt, 1 To 1)
ShtNum = 1
For Each sht In ActiveWorkbook.Sheets
If sht.Name = ActiveSheet.Name Then _
ListPos = ShtNum - 1
SheetData(ShtNum, 1) = sht.Name
ShtNum = ShtNum + 1
Next sht
With ListBox1
.ColumnWidths = "100 pt;50 pt"
.List = SheetData
.ListIndex = ListPos
End With

Cheers

A Sheet's Number Or A Sheet's Name Using A Macro
Hi,
I have searched for a way to let a macro copy a sheet and move it to (before) a special sheet - let's call it "Special".

The code Sheets("Origin").Copy Before:=Sheets("Special") worked fine for some days but not any longer.

When a macro records this it writes
Sheets("Origin").Copy Before:=Sheets(4)
where 4 stands for sheet number 4 (even if sheet 3 is hidden). Sheet number 5 is then "Special".

It is a complicated to use the sheets' numbers instead of the names I have given them. Any move of a sheet makes the macro not work as intended and I also have the intention to let a macro copy and rename sheets so keeping track of the numbers will be tough.

Do you know a way how solve this? Thanks in advance!





Edited by - benes on 12/10/2006 9:09:09 AM

Fill Cells From Sheet To Other Sheet
i have this userform MODIFICHE.
sheet REPORT is filled from a value into variuos textbox. Work fine....
sheet cartel1 is the data base of record.
I would want to fill during the scroll vevent into REPORT the list of value refered the actual record show into userform.
Example:
I scroll the record actually, show is ARNESE CIRO, i would want to fill the sheet REPORT with all line refred to ARNESE CIRO into REPORT started from line 38.
Note the unique id for each record is into column D (CERTIF)

here the file...
http://www.mytempdir.com/407468

Importing Data From One Closed Excel Sheet Into Another Open Excel Sheet
Dear all,
   I am VBA newbie ... I need your help in importing the data froma closed excel document into another excel document.

Please help.
Cheers
Vivek

Is't Possible To Put "Data" In Excel Sheet Or Value In DBGrid On Excel Sheet
I would like to Export Table .mdb connect with Data1 to an Excel Sheet. Is't possible with VB code?

Second option I have the same data in DBGrid is't possible to put Data in DBGrid on Excel Sheet.

Thanks
Redg

Text From A Merged Cell On One Sheet To A Merged Cell On A Second Sheet
Here is what I am trying to do. When a user clicks a checkbox, the linked cell is read, if it = True then the information is copied from a cell into the first empty cell on a different sheet. The cells that the info is copied from is merged as is the cell that the info is pasted into. This is for Excel97. What is below is the whole of the code. Should there be declarations at the beginning? Or anything that is standard for VBA? I am close, but I get an error. This line:
Worksheets("Complete").Range("B" & x).Value = Sheet2.Range("B23").Value
gives an application-defined or object-defined error. I have tried several variations of the code. The text is being copied onto sheet6, also called Completed. I have tried it both ways.
Code:
Private Sub Check33_Click()
   
   Dim x As Range
   Sheet6.Activate
   Set x = Cells(Rows.Count, "B").End(xlUp)(2)
   'x = ActiveSheet.UsedRange.Rows.Count
   If Sheet2.Range("K23").Value = True Then
   Sheets("Complete").Select
   Worksheets("Complete").Range("B" & x).Value = Sheet2.Range("B23").Value
   End If
End Sub
 

Here are some other ways that I tried to do this
Code:
Private Sub Check33_Click()
   
   Dim FirstEmpty As Range
   Sheet6.Activate
   Set FirstEmpty = Cells(Rows.Count, "B").End(xlUp)(2)
      
   If Sheet2.Range("K23").Value = True Then
   ActiveWorkbook.Sheets("Sheet6").Range(FirstEmpty).Value = Sheet2.Range("B23").Value
   End If
End Sub

Code:
Private Sub Check33_Click()
  Dim lastRow As Long
    ThisWorkbook.Activate
    SheetA.Activate
    'lastrow is the last row without data
    lastRow = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row + 1
    
    If Sheet2.Range("K23").Value = True Then
       SheetA.Range("lastRow").Value = Sheet2.Range("B23").Value
    End If
End Sub


This version gives a 'subscript out of range' error
Code:
Private Sub Check33_Click()
   
   Dim x As Range
   Sheet6.Activate
   Set x = Cells(Rows.Count, "B").End(xlUp)(2)
   'x = ActiveSheet.UsedRange.Rows.Count
   If Sheet2.Range("K23").Value = True Then
   Sheets("Sheet6").Select
   Worksheets("Sheet6").Range("B" & x).Value = Sheet2.Range("B23").Value
End If
End Sub


If anyone can help, I would be eternally grateful!

Kingman

Next Sheet
Can anyone help me out here?

I want to use a macro on a button, to jump to a next sheet in my excel-workspace (say from a to b)

is there an option, or can I only use HYPERLINKS?? (please no)


WHAT I HAVE is :

Sub
Sheets("Main").Activate
End Sub

But I'd like it to be more effortable, thus

'main' would be 'next' in general, no matter WHERE I am on my Worksheet


Elmer

From Sheet 1 To Sheet 2!!!!!!
Hi All

I have recently created a file that contains 2 Sheets.

Sheet 1 holds all my data and Sheet 2 is to hold certain bits of data from Sheet 1.

I was informed that if i used Data|Filter|Advance Filter, that i would be able to copy selected information from one sheet on to another.
However, when i came to do this, a message kept on appearing saying 'Can only filter data in active sheet' (or something very similar).

Is it possible to filter data from one sheet to another?
If not, can someone please advise me on how i can do something similar.

Thanks

Add Sheet After Last Sheet
Dear

how can we add sheet after last sheet in excel through Vb.

Please show an example

How To Get Sheet Name From Excel Using VB6
ok.. i have code that imports an excel spreadsheet.. right now.. i have hardcoded the following line which works unless the spreadsheet page name is something else..

Set ws = wb.Sheets("Sheet1")

how can i set this using a variable so the sheet name doesnt have to be "Sheet1" in order to get this to work...

code
=========================================================
'Imports the new Data from data managment into temp table
Dim Y As String
Dim xl As Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet

Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset

Dim r As Long
Dim rmax As Long

Set xl = New Excel.Application
Set wb = xl.Workbooks.Open(Y)
Set ws = wb.Sheets("Sheet1") ----- Problem line here...

thanks for the advice

Output To A Different .csv Sheet??
I have a very standard bit of code (see below) which outputs values which have been stored in the variable KeepRecord(). Everything outputs fine etc... I was wondering is there a way of choosing to write into sheet 2 from this code instead of the default Sheet 1? It's just a psych experiment program which records the data and outputs it so I don't need any heavy integration etc... Just was wondering can I do it from this code or need to use a proper component. I know nothing about this kind of stuff.

Private sub CmdSave()
Dim i As Integer

Open FileName & ".csv" For Append As #1
Write #1, "File created on the " & Format(Date, "dd/mm/yy")
Write #1, ""
For i = 1 to 20
Write #1, KeepRecord(i)
Next i
Close #1

End sub


Thanks,

S.

Get The Name Of An Excel Sheet
hello,
i have a program that automates excel from vb. i'm trying to get the name of the active worksheet then assign the name to a variable in vb. does anyone have any ideas on how to do this. i've been trying things like


Code:
txtGraphTitle.Text = ActiveWorkbook.Sheets(Name)

but had no success

thanks a lot

Create New Sheet
1. How do you create a new sheet in an existing excel file that as a specific name, i.e. Bill ?

I want to continue to add and remove sheets from an existing file.

2. How do you remove Data from a Cell on a sheet?

I know how to add information, but remove is something else.


Thanks for the help

Excel Last Sheet
How do you determine the name of the last sheet in a workbook. Once this has been done how do you add a sheet after the last one, every time I add one it inserts it before

Active Sheet
I am just starting out Coding in excel. What I'm trying to do is get the sheet name that the user is switching to next. Right now i'm trying the sheetActivate command. The next problem is getting the acual sheet name. I need the name to set it active in code which i have writen.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)

end sub

If anyone could help that would be great.

Thanks


-Pilosi

Choosing A Particular Sheet
What is the syntax to pick a specifcally named sheet to paste to instead of the "active sheet". The sheet name would be "2002". What I have so far will copy info from a database and paste it into the active sheet:

Option Explicit


Sub GetData2()

Dim cnt As New ADODB.Connection
Dim rst As New ADODB.Recordset

Dim xlWs As Object


Dim recArray As Variant

Dim strDB As String
Dim fldCount As Integer
Dim recCount As Long
Dim iCol As Integer
Dim iRow As Integer

' Set the string to the path of your database
strDB = "\\Quartz\Common\Comptrol\Corp_Rep\MONTHEND\2002\Monthly Stewardship\Stewardship Master Files\Costbudget.mdb"

' Open connection to the database
cnt.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strDB & ";"

' Open recordset based on Cost and Budget query
rst.Open "Select * from qryCOSTBudget 2002", cnt

' Set the sheet where data will be copied
Set xlWs = "2002"

Find A Value In A Sheet
how can i find a value at a particular column for example first i want to find a value in the usedRange and if i find then i want to find a value in the same column as the previous value.....i m doing something like this

Set rngid = shtcon.UsedRange.Find("Name")
msgbox rngid.column

"now this does return a value"

but now i want to find another value which is within that column but i don't know which row.....


how can i do that ?


waqas

Excel Sheet Name
Hi All,

I am writing an app (in VB6 using ADO2.5) that lets the user select an Excel file for retrieving 2 columns. They have to know the column numbers they want and the Worksheet name for what I have written so far.
What I would like to do is retreive the worksheet name(at least the first one, preferable all so I can put in dropdown) so they dont have to look it up, or maybe there is a way to just use numbers? I currently use

SQL1 = "SELECT * FROM [Sheet1$];"

I was hopeing when I first saw this code it was object Sheet1 rather than name sheet1.

Also if there is 20 columns I am currently selecting all as I couldnt work out how to select just the 2 columns, which is why I using column numbers(by referenceing RS) instead of Alphabet, this slows it down
I tried below, didnt work!

SQL1 = "SELECT B,F FROM [Sheet1$];"
SQL1 = "SELECT 2,6 FROM [Sheet1$];"

Any help Appreciated!
I prefer to use Alphabet Columns if possible

David

Checking Sheet Name
Is there a way to check if a sheet exits or not? I have created a reporting spreadsheet that uses several combo lists. Depending on the choices, certain sheets are created, but otherwise, are not present. I would like to do the following, but don't know how to get there:

if (sheet1 exist) then
....
end if

Any help would be much appreciated.

TIA

Pasting From One Sheet To Another
I am trying to paste information from one sheet to another sheet. I am using the following code:

sheets("Sheet2").select
activecell.range("C20") = value

It is not going to the proper cell unless the curvser starts in cell A1. Is there a way to get around this. If this question is not clear, I can paste the entire code that I am using.

Any help would be greatly appreciated. Thanks.

Delete Sheet
hi,

i'm deleting a sheet on excel using VBA and the error message comes up to say
"The selected sheets will be permanently deleted..."

how can i delete the sheet without getting that message?

thanx

"Once I was but the learner, Now I am the Master" - Darth Vader

Excel Sheet Name
i m getting a run time error of giving type mismatch when i m throwing the sheets name in a combo box, i dunno why its giving this error although its working correct with another excel workbook.

this is the code

For Each shtcon In xlbook.Sheets
Form1.Combo1.AddItem shtcon.Name
Next

when i right move mouse on shtcon.name while in the debug mode it says "object variable or with block variable not set"

any help would be appreciated

waqas

Sheet Navigation
G'day,

Is it possible to allow a user to scroll through a sheet to find cell references to enter into an inputbox while the inputbox is active? Or is there another work-around?

I have a sheet which contains at least one pivot table, and need to have the information from the pivot table used to input into another workbook.

Just to give a little background, the pivot table contains two columns. The first (i.e. Row in pivot table) contains a number which represents a column and row (i.e. 10360 = column 10, row 360). The next column (i.e. Data in pivot table) represents the totals from the raw data (e.g. for 10360).

Here is my sub so far:
Code:
Sub TrfNumToFRAMME()
' This procedure will copy numbers from one location to another based
' on a number contained in a cell which gives column and row numbers.
' First, set variables
Dim intCat1 As Integer
Dim intTargetRow As Integer
Dim intRowSource As Integer
Dim intColSource As Integer
Dim intRowNum As Integer
Dim strQuestion As String
Dim intAnswer1
Dim intAnswer2
Dim fileToOpen1
Dim filetoopen2
Dim strRange As String
On Error GoTo ErrorHandler
' Open the source spreadsheet
MsgBox "Please open the workbook containing the Pivot Table", vbOKOnly, "Pivot Table Input to FRAMME"
fileToOpen1 = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
If fileToOpen1 <> False Then
strQuestion = MsgBox("Open " & fileToOpen1, vbOKCancel, "ARE YOU SURE?")
If strQuestion = vbOK Then Workbooks.Open (fileToOpen1)
End If
If ActiveWorkbook.ReadOnly Then
strQuestion = "Please note this file is in read-only mode." & vbCrLf
strQuestion = strQuestion & "You will need to re-open this file later to" & vbCrLf
strQuestion = strQuestion & "make any changes. Press OK to continue."
MsgBox strQuestion
End If
fileToOpen1 = ActiveWorkbook.Name
strQuestion = ""
' Open the target spreadsheet
MsgBox "Now, open the FRAMME Input workbook", vbOKOnly, "FRAMME Input"
filetoopen2 = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
If filetoopen2 <> False Then
strQuestion = MsgBox("Open " & filetoopen2, vbOKCancel, "ARE YOU SURE?")
If strQuestion = vbOK Then Workbooks.Open (filetoopen2)
End If
If ActiveWorkbook.ReadOnly Then
strQuestion = "Please note this file is in read-only mode." & vbCrLf
strQuestion = strQuestion & "You will need to re-open this file later to" & vbCrLf
strQuestion = strQuestion & "make any changes. Press OK to continue."
MsgBox strQuestion
End If
strQuestion = ""
filetoopen2 = ActiveWorkbook.Name
' Enter the range of the data to be input into the FRAMME workbook
Application.Workbooks(fileToOpen1).Activate
strQuestion = "Input the top-left cell reference for" & vbCrLf
strQuestion = strQuestion & " the table to be transfered to FRAMME."
intAnswer1 = InputBox(strQuestion, "Upper-Left Cell Reference")
strQuestion = "Input the bottom-right cell reference" & vbCrLf
strQuestion = strQuestion & "for the table to be transfered to FRAMME."
intAnswer2 = InputBox(strQuestion, "Lower-Right Cell Reference")
strRange = intAnswer1 & ":" & intAnswer2
' Read the range references from the pivot table, then paste relevant totals to
' the FRAMME workbook.

. . .

intRowNum = LastRowInColumn(1)
Do While intCat1 < intRowNum
If Len(Cells(intRowSource)) = 5 Then 'If the cell length is 5, then continue
intTargetRow = Mid(Cells(intRowSource, 3), 2, 4)
' Now copy the number in the cell, from the second character
'
' Paste the information - from the cell to the right of the cell containing the row and column
' number - into the target sheet
Cells(intTargetRow, intCat1).Value = Cells(intCat1 + 1 & intRowSource)
intCat1 = intCat1 + 1
intRowSource = intRowSource + 1
Else: If Len(Range("C" & intRowSource)) = 6 Then intTargetRow = _
Mid(Range("C" & intRowSource), 3, 4)
Cells(intTargetRow, intCat1).Value = Range("D" & intRowSource)
intCat1 = intCat1 + 1
intRowSource = intRowSource + 1
End If
Loop

. . .

End Sub
Thanks,

Mitchys

Pick Sheet
Hello everyone! I need a littlie help pleas.

I have landed a new job and would like to make a few of my daily tasks a little easer.

I have created an Excel sheet that I need to do a few things with. This is what I need it to do. I work for a distributor and I need to make a pick sheet for the forklift drivers every morning so I need the Excel sheet to do things like check if the model number I enter is correct and ask what color. Then add it to the sheet. If I have already entered that model and color I would like it to change the quantity.

I need it to do a lot more but I will start here and then when I have all of the worked out I will move on.

Thanks for any help.

Delete Sheet
I want to delete a sheet from workbook without any instructions or message box. When i try to delete the sheet it ask

"Data may exist in the sheet(s) seletion for deletion. To permanentely delete the data, press delete."

How can I do this?

Thanks and Regards
Manish Rajpal

Use VB To Get The Work Sheet Name?
Dear all,

Got a little problem here. Does anyone know how to use VB to get the Work sheet name without using excel control? Can it be achieve with ADO Control??? I am looking at this option because the machine that this application will run may not have excel installed and might installed with different version of excel. Appreciate if anyone can provide some hints and tips. Thanks.

Hiding A Sheet
I have created a UserForm which is he way I will have users interface to the Spreadsheet. I will place the Spreadsheet that does the calculations in the second sheet of the workbook. I am writing and reading from the Sheet2.

I want to hide Sheet 2 when I open the spreadsheet. How do I do that?

Thanks


Code:

' Where do I put the statement to hide Sheet2??

Public InputName As String

InputName = Worksheets("Sheet2").Range("B3").Value

' Is this correct to not have to use
' Worksheets("Sheet2") all the time

ActiveSheet = Worksheets("Sheet2")

If Function With Sheet(name)
Is it possible to include a sheet into an "if" statement?

I have a crap load of information that I want to split onto multiple sheets.
So I want to check Cell(i , 9) "name" if = to sheet.name then paste in order, if not them Sheet(name).Add, continue.

does this sound logical or will I be wasting my time? How do I compare sheet names without knowing exactly what the sheet name is?

Name A Sheet When Creating It
I'm using the following code to name a new worksheet when I add it but it's not working...any suggestions?


Code:
Sheets.Add
ActiveWindow.SelectedSheets.Name="SheetName"

Getting Values From An Other Sheet
I am maintaining a memberlist with monrhly payments and wants to ad a formula, refering to a cell in Newsheet to Oldsheet when i add a new member

vb
ThisWorkbook.Worksheets("OldSheet").Activate
Range("a2").Activate
If Range("a2").Value = "" Then
Range("a2").Activate
Else
Range("a2").CurrentRegion.Select
ActiveCell.Offset(Selection.Rows.Count, 0).Activate
End If

With ActiveCell
.Value = "*"
.Offset(0, 1).Value = Val(TxtMedlemsnummer)
.Offset(0, 2).Value = TxtNavn
.Offset(0, 3).Value = TxtAdresse
.Offset(0, 4).Value = TxtPostnummer
.Offset(0, 5).Value = Val(TxtTelefon)
.Offset(0, 6).Value = TxtEmail
.Offset(0, 8).Value = X

I wants this cell (X) to always show the value of cell f1 in the next sheet.


Set wsNytRegneark = Worksheets.Add
wsNytRegneark.name = "NewSheet"
Sheets("Nyt").Range("A1").Value = "*"
Sheets("Nyt").Range("d1").Formula = "=sum(d3:d60000)"
Sheets("Nyt").Range("e1").Formula = "=sum(e3:E60000)"
Sheets("Nyt").Range("f1").Formula = "=d1-e1"
Sheets("Nyt").Range("A2").Value = "*"
Sheets("Nyt").Range("A3").Value = "*"
Sheets("Nyt").Range("b3").Value = "Opkrævning udsendt d."
Sheets("Nyt").Range("c3").Value = "Kontingent indbetalt d."
Sheets("Nyt").Range("D3").Value = "Beløb opkrævet"
Sheets("Nyt").Range("E3").Value = "Beløb indbetalt"
Worksheets("Newsheet").Columns.AutoFit
Sheets("Newsheet").name = TxtNavn

Please Help. I have read thru a lot of issues, but can't find a solution

Change Sheet Name
Can you please help me with this problem?

I have an overview sheet that should name all the other sheets.
_____
Cell E6 in sheet1 (named “overview”), should give the name to sheet2
Cell K6 in sheet1 (named “overview”), should give the name to sheet3
Cell E16 in sheet1 (named “overview”), should give the name to sheet4
Cell K16 in sheet1 (named “overview”), should give the name to sheet5
_____
The sheet names should of course be updated when I update the cells in the overview sheet.

I have some code for updating sheet names:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

Sh.Name = Target.Value(A1)

End Sub

But it will only update within the same sheet
Anybody know how to solve this problem
Thanks

Sorroo

Hidden Sheet
Is it possible to have av command button or a hyperlink to a hidden/very hidden sheet in the same workbook?

Tried the normal way with:

Private Sub CommandButton1_Click()
Sheets("name of sheet").Select
End Sub

But it didn´t work, is there a way to bypass this?

Tried with hyperlinks to but once u hide the sheet it doesn´t work.
I prefer to have a hyperlink to a hidden sheet, but if not possible a command button will do the trick.

Thanks people, hope u can help me.
Gilmore

Lock Sheet Name
Hi
Using Excel VBA, is there a way to prevent someone from renaming a sheet?

Thanx

Rename Sheet
In VB code there is a new sheet added to a workbook. The sheet name is changed, the changing is visible on screen. A new sheet is added to the same book, that sheetname is also changed (different from the first).

My problem is that the first added sheet looses it name and is changed in a standard excel name, for example sheet2.


Code:

Sheets.Add after:=Sheets(1)
a = Sheets.Count
Sheets(1).Select
Sheets(a).Name = maand

Sheet Tabs
hello,

I am copying data from a source file to a destination file using VB. Have no problems with that. The files comes on a monthly basis.

The problem I am finding is that the sheet tabs can be a different name sometime outlining what date it is. i.e. summary "a date" where summary is the name of the sheet and then a date is put on the end of that. eg summary 311104

Given that the format of the sheet tabs will always be the same (except for the date), is there anyway to tell VB to go and select the sheet named with at least "summary" in it - is that anyway possible ?

Thanks

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