Ανανέωση ιστοσελίδας

Excel - Ερωτήσεις / Απαντήσεις Ότι έχει σχέση με συναρτήσεις, μορφοποίηση, εκτυπώσεις γραφήματα κτλ.

 

 

Εργαλεία Θεμάτων Τρόποι εμφάνισης
Prev Προηγούμενο μήνυμα   Επόμενο Μήνυμα Next
  #1  
Παλιά 29-10-11, 18:31
Όνομα: Θανάσης
Έκδοση λογισμικού Office: Ms-Office 2013
Γλώσσα λογισμικού Office: Αγγλική
 
Εγγραφή: 13-02-2010
Μηνύματα: 62
Προεπιλογή Excel 2010 Error 91

Καλησπέρα

Χρησιμοποιώ την ακόλουθη VBA για την εύρεση ονόματος. Στην περίπτωση που δεν υπάρχει το όνομα μου δίνει σφάλμα 91.
Θα παρακαλούσα κάποια βοήθεια.
Ευχαριστώ εκ των προτέρων.

Κώδικας:
'Attribute VB_Name = "FindText"
Sub FindText()

Dim i As Long
Dim Fnd As String
Dim fCell As Range
Dim ws As Worksheet
Dim Color As Long
Dim rngCurr As Range

    Fnd = InputBox("Enter text to search" & vbCr & vbCr _
            & "Click OK to search the entire workbook for all instances of the search text." & _
            " Each instance will be highlighted. This search is not case-sensitive, but it will not" & _
            " locate search text if its cell contains other text, including a formula.")

If Fnd = vbNullString Then
           Exit Sub
End If

Application.ScreenUpdating = False
Application.Dialogs(xlDialogPatterns).Show 'shows color palette
Color = ActiveCell.Interior.Color 'stores index number of selected color
ActiveCell.Interior.Color = xlNone
 'since previous line colors cell where cursor pointer is, this removes the shading from that cell
   
Application.ScreenUpdating = True

    Cells.Find(What:=Fnd, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
        :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
        False, SearchFormat:=False).Activate
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = Color
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
        
first_pos = ActiveCell.Address 'first cell found

Cells.FindNext(After:=ActiveCell).Activate 'find the next cell if any

While ActiveCell.Address <> first_pos 'while nect cell is not the first one

    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = Color
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    Cells.FindNext(After:=ActiveCell).Activate
    
Wend

End Sub

Τελευταία επεξεργασία από το χρήστη Tasos : 29-10-11 στις 23:43. Αιτία: Ρύθμιση πλάτους πλαισίου κώδικα
Απάντηση με παράθεση
 


Δικαιώματα - Επιλογές
Δε μπορείτε να δημοσιεύσετε νέα μηνύματα
Δε μπορείτε να δημοσιεύσετε απαντήσεις
Δεν μπορείτε να επισυνάψετε αρχεία
Δεν μπορείτε να επεξεργαστείτε τα μηνύματα σας

Ο κώδικας ΒΒ είναι σε λειτουργία
Τα Smilies είναι σε λειτουργία
Ο κώδικας [IMG] είναι σε λειτουργία
Ο κώδικας HTML είναι εκτός λειτουργίας
Trackbacks are εκτός λειτουργίας
Pingbacks are εκτός λειτουργίας
Refbacks are εκτός λειτουργίας


Παρόμοια Θέματα

Θέμα Δημιουργός Forum Απαντήσεις Τελευταίο Μήνυμα
[Excel07] Κατάργηση σύνδεσης κελιών στο Excel 2010 George R Excel - Ερωτήσεις / Απαντήσεις 1 13-12-16 16:31
[ Φόρμες ] στο Open της φορμας, Runtime error 2105 access 2010 Dafnh0106 Access - Ερωτήσεις / Απαντήσεις 2 19-12-12 10:05
[Συναρτήσεις] Υπολογισμός due date στο excel 2010 και μηδενισμός της ειδοποίησης Kostas K Excel - Ερωτήσεις / Απαντήσεις 2 07-09-12 14:15
[Excel07] Δημιουργία αντιστοίχισης XML (Xml map) Excel 2007 - 2010 Tasos Excel samples - Χρήσιμα αρχεία & παραδείγματα 0 16-06-12 12:15
[Γενικά] EXCEL 2010 ΦΑΚΕΛΟΣ wzbabb panda Excel - Ερωτήσεις / Απαντήσεις 2 31-12-10 09:50


Η ώρα είναι 17:23.