Proszę. [syntax=vbscript]Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Column = 1 Then r = Target.Row nw = Sheets("Arkusz2").Cells(Rows.Count, "A").End(xlUp).Row + 1 Range("A" & r & ":E" & r).Copy Sheets("Arkusz2").Cells(nw, 1) End If Cancel = True End Sub [/syntax]
W kod arkusza wklej[syntax=vb]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count = 1 And Target.Column = 5 And Target.Value <> "" Then wrs = Columns(5).Find(what:=Target.Value, lookat:=xlWhole).Row Target.Offset(0, 1) = IIf(Target.Row = wrs, "", Cells(wrs, 6)) End If End Sub[/syntax]W przypadku braku odpowiednika znajdzie sam...
Najprawdopodobniej zaznaczasz >1 komórkę. Dopisz warunek: [syntax=vb]Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Sh.Index > 10 Then If Target.Cells.Count = 1 Then If Target.Address(0, 0) = "A1" And Target.Value <> "" Then Sh.Name = Target.Value End If End If End If End Sub[/syntax]
[syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 3 Then Cells(Target.Row + 1, 1).Select End Sub [/syntax]
Można postąpić tak: Odblokować wszystkie komórki w arkuszu (a przynajmniej te, które mogą podlegać edycji). Włączyć ochronę arkusza. Do kodu arkusza wpisać procedurę obsługi zdarzenia Change: [syntax=text]Private Sub Worksheet_Change(ByVal Target As Range) ActiveSheet.Unprotect Target.Locked = True ActiveSheet.Protect End Sub [/syntax] Jeśli arkusz...
[syntax=vb]Private Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next r = Date - Target.Cells If Target.Column = 2 And r > 30 Then w = Target.Row Cells(w - 1, 5) = "" Cells(w, 5) = "" End If End Sub [/syntax]
Autofilter 'złapie się' tylko na calculate Przenieś zdarzenie selection change na doubleclick [syntax=vbscript]Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) ActiveWorkbook.Names("AktywnyWiersz").Re... = Target.Row End Sub[/syntax]
Co w przypadku jesli klikasz na B6, lub F4 itp.? Dodano po 3 w kodzie arkusza[syntax=vb]Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Count = 1 And Target.Column = 1 Then Cells(1, 1) = Cells(Target.Row, 1) End Sub [/syntax]
Można do tego wykorzystać makro zdarzeniowe, na przykład takie: [syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) Dim cel As Range Application.EnableEvents = False For Each cel In Target If Len(cel) > 0 Then If Left(cel, 1) <> "'" Then cel.Value = "'" & cel.Value End If Next cel Application.EnableEvents = True End Sub...
Myślę, że sprawdzanie czy [syntax=vbscript]If Range("C1") = "" Then Range("C1") = Range("A1") Else ...[/syntax] jest tu niepotrzebne - pusta wartość C1 będzie potraktowana jako 0. Ja bym to widział nieco krócej: wersja "jednokomórkowa"[syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$1" And IsNumeric(Target.Value)...
Można pokombinować z funkcją WYBIERZ a godzinę wstawiać kombinacją Ctrl+Shift+":" Prościej (wygodniej) jednak będzie wykorzystać VBA. Wklej w kod arkusza, wypróbuj i dostosuj do własnych potrzeb Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 And Target.Count = 1 Then Target.Offset(0, 2) = Format(Time(),...
Witam, Proponuję modyfikację kodu np taką :D : [syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) Application.EnableEvents = False If Target.Column = 1 Then Target.Offset(, 1) = Time End If If Target.Column = 3 Then Target.Offset(, 1) = Time End If With Sheets("Arkusz1") For Each obszar In .Range("a1:a" & Target.Row) If obszar.Value...
Oj, bo nie doczytałem. Chcesz usuwać dane z H,I,J,K, zostawiając formułę w L. To wykorzystaj SelectionChange w kolumnie P, gdzie widać tekst "Dodaj". [syntax=vb]Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Column = 16 And Target.Value = "DODAJ" Then MsgBox Target.Row End If End Sub[/syntax]
[syntax=vb]Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("V15:V16")) Is Nothing Then If Target.Address = "$V$16" Then r = 1 Target.Offset(-10 - r, 3).Resize(2, 2).Copy Target.Offset(r * 2, 2) End If End Sub [/syntax]
Zobacz, czy teraz jest to o co Ci chodziło. Target odnosi się do tego arkusza, w którym występuje zdarzenie i jest to odwołanie, a Target.Address jest tekstem adresu bez kwalifikatora arkusza, więc można go użyć w dowolnym arkuszu.
klikając na konkretną komórkę 2 x klik: [syntax=vbscript]Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Address = "$K$11" Then UserForm1.Show Cancel = True End If End Sub [/syntax]
Wygodniej tak: [syntax=vbscript]Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Column = 1 Then Rows(Target.Row).Delete Cancel = True End If End Sub [/syntax]
[syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) If Target = "" Then Exit Sub[/syntax]
[syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 12 And Target = "przegrany" Then If Cells(Target.Row, "M") = "" Then MsgBox "Wprowadź komentarz!", vbCritical, "UWAGA" End If End Sub [/syntax]
Można jeszcze tak. (dla pojedynczych danych) [syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column <> 1 Then Exit Sub If Target.Count > 1 Then Target = "": Exit Sub If Application.CountIf(Columns(1), Target) > 1 Then Target = "" End Sub[/syntax]
Przekaż Nr wiersza jako argument [syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next If Target.Cells.Count > 1 Then Exit Sub Set xRg = Intersect(Range("c5:c4000"), Target) If xRg Is Nothing Then Exit Sub If IsNumeric(Target.Value) And Target.Value < 100 Then Call Mail_small_Text_Outlook(Target.Row) End If...
Wklej w kod arkusza(y) i wypróbuj taką procedurę zdarzeniową [syntax=vb]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 4 Then With Sheets("Arkusz3") w = .Range("B:B").Find(what:=Target.Offset(0... -2), Lookat:=xlWhole).Row k = .Cells(w, 1).End(xlToRight).Column + 1 .Cells(w, k) = Target.Value End With End If End Sub[/syntax]
[syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$C$2" Then Application.ScreenUpdating = False nw = Sheets("Baza").Cells(Rows.Count, "A").End(xlUp).Row + 1 Range("A2:C2").Copy Sheets("Baza").Cells(nw, 1).PasteSpecial xlPasteValues Range("A2").Select Application.CutCopyMode = False Application.ScreenUpdating =...
Najprościej: Nie zadziała jeśli target jest większy niż pojedyncza komórka (np. wklejanie kilku komórek). Odnośnie mojego przykładu - a u mnie działa ;) tzn. reaguje tylko na wiersz 5. Edit: Mała modyfikacja eliminująca pewną niedogodność przy wklejaniu kilku komórek na raz ;) [syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) Dim...
Chyba wygodniejsze będzie oprogramowanie zdarzenia Worksheet_Change, tylko nie zapomnij o wyłączeniu obsługi zdarzeń na czas podmiany wartości. [syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("C4:C6")) Is Nothing Then Exit Sub Application.EnableEvents = False If Target.Count = 1 Then Target.Value = UCase(Target.Value)...
A tak [syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 6 Then Target.Offset(, -5).Value = Date If Target.Column = 7 Then Target.Select End Sub[/syntax]
lub [syntax=vb]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 7 And Target > 0 Then Rows(Target.Row).Hidden = True End Sub [/syntax] lub odpalic dla aktywnego arkusza [syntax=vb]Sub ukryj() For r = 2 To Application.CountA(Columns(1)) - 1 Rows(r).Hidden = Cells(r, 7) > 0 Next End Sub [/syntax]
Kliknij prawym klawiszem myszki na zakładce arkusza, wybierz Wyświetl kod i w Edytorze VBA wklej Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 3 Then Target.Offset(0, 1) = Application.UserName End If End Sub Co robi to makro? Po każdej zmianie jaka następuje w kolumnie C (Target.Column = 3) wstawia w kolumnę...
Blokowanie uzyskasz poprzez założenie hasła. Numerowanie komentarzy poniżej. [syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) Dim a As String If Not Application.Intersect(Range("A1:C10"), Range(Target.Address)) Is Nothing Then i = Environ("USERNAME") & " <" & Now & ">" & vbNewLine & Target & vbNewLine...
Jeżeli w komórce ma się "pojawić" napis "Nie dotyczy" a w innym przypadku masz wprowadzać datę to tak jak sam napisałeś w pierwszym poście: tylko proste makro to załatwi. Niestety funkcja jeżeli w tym przypadku to za mało. Kłopot polega że nie masz pojęcia o makrach (jak sam mówisz), a makro trzeba ustawić w "modułach zdarzeniowych" arkusza. Np. takie:...
Korzystając z opisów kolegów np. z tego wątku https://www.elektroda.pl/rtvforum/viewto... oraz przenosząc sumowanie w Arkuszu2 z dołu do góry (łatwiej znaleźć pierwszą pustą komórkę w kolumnie) możesz użyć takiej procedury: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Row...
Co zrobić, aby po po zmianie wartości w kolumnach 5,6,7,8; Data i godzina w kolumnach B i C pozostała niezmieniona. Odpowiadając tak na "sucho" ... trzeba do kodu dodać coś takiego: Wariant I If Target.Column = 5 Or Target.Column = 6 Or Target.Column = 7 Or Target.Column = 8 Then " można skrócić do " If Target.Column >= 5 And Target.Column <=...
To wypróbuj najprostsze połączenie kodów :spoko: : [syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Target.Cells.Count > 1 Then Exit Sub If IsNumeric(Target) And Target.Address = "$A$5" Then Select Case Target.Value Case 1: Firma_1 Case 2: Firma_2 Case 3: Firma_3 Case 4: Firma_4 Case 5: Firma_5 Case 6: Firma_6 Case 7: Firma_7...
Ile jeszcze będzie tych wariantów? Jeśli adresy list są różne, to najrozsądniej, jak myślę nadać im takie same nazwy i te nazwy wykorzystać do identyfikacji. Przykładowy kod: [syntax=vb]Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) Dim wks As Worksheet, nazwa As String If Target.Count > 1 Then Exit Sub If Intersect(Target,...
[syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$10" Then Application.EnableEvents = False Range("A11:B" & Cells(Rows.Count, "A").End(xlUp).Row).ClearContents ow = 5 ok = Cells(1, Columns.Count).End(xlToLeft).Column x = Target.Row + 1 For k = 1 To ok Set a = Range(Cells(1, k), Cells(ow, k)).Find(Target, LookIn:=xlValues,...
W kodzie arkusza [syntax=vbscript]Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Column = 1 Then Target.Resize(, 2).Interior.Color = vbRed Sheets("Arkusz2").Cells(Rows.Count, 1).End(xlUp).Resize(, 2).Offset(1) = Target.Resize(, 2).Value Cancel = True End If End Sub[/syntax]
Spróbuj tak: [syntax=vbscript] Option Explicit Private a Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Intersect(ActiveCell, Range("C:E")) Is Nothing Then a = ActiveCell End Sub Private Sub WorkSheet_Change(ByVal Target As Range) Dim i As Integer i = Target.Row If Target.Column = 3 Or Target.Column = 4 Or Target.Column = 5 Then...
Przy podwójnym kliknięciu to będzie coś takiego: [syntax=vb]Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Column > 2 And Target.Column < 6 Then UserForm1.Show End If End Sub [/syntax]
[syntax=vbscript]Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Column = 1 Then Application.Cursor = xlWait x = Target.Row a = Cells(x, "A") & "-" & Cells(x, "C") & "-" & Cells(x, "F") & "-" & Cells(x, "I") & "-" & Cells(x, "J") Set w = CreateObject("Word.Application") Set d = w.Documents.Add w.Visible =...
Spróbuj procedury zdarzeniowej. Np [syntax=vb]Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Intersect(Target, Range("K5:K13")) Is Nothing And Target.Count = 1 Then For Each kom In Range("B3:F7") If kom.Value = Target.Value Then kom.Font.Bold = True Else kom.Font.Bold = False End If Next End If End Sub[/syntax]Wklej w kod arkusza,...
[syntax=vb]Private Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next If Target.Column = 5 Then nw = Sheets("Logistyka").Cells(Rows.Count, "A").End(xlUp).Row + 1 If nw = 2 Then nw = 1 w = Target.Row Range(Cells(w, 1), Cells(w, 5)).Copy Sheets("Logistyka").Cells(nw, 1).PasteSpecial xlPasteValues End If End Sub [/syntax] Kod na tyle prosty,...
A w taki sposób próbowałeś? [syntax=vb]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$B$2" And Target.Value <= 10 Then MsgBox "Wartość poniżej 10!", 64, "Wesołych Świąt" End If End Sub[/syntax]
zrobic jedna komorke w ktorej bede wpisywal litere Np komorka jest "G1" [syntax=vb] Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$G$1" Then If Not Application.CountIf(Range("F:F"), Target) = 0 Then ActiveWindow.ScrollRow = Application.Match(Target, Range("F:F"), 0) End If End If End Sub [/syntax]
Dla przykładu No właśnie dla przykładu, to przydałby się przykładowy plik. Dodano po 4 Nie pisz na PW proszę, skoro plik dotyczy tematu.
Należy oprogramować zdarzenie SheetChange skoroszytu. Wykrywa ono równocześnie, w którym arkuszu i w której komórce nastąpiła zmiana. Kod: [syntax=text]Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Target.Address <> "$F$6" Then Exit Sub If IsNumeric(Target) And Target > 0 Then Sh.Tab.Color = vbRed Else Sh.Tab.Color...
Jeśli ma być więcej takich samych list w tym samym arkuszu, to należy je skopiować ręcznie, a następnie użyć np. takiego makra (zamiast tego poprzedniego). Dodałem tu jeszcze zabezpieczenia przed błędami. [syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) Set Target = Intersect(Target, Range("D1, G3, J3")) If Target Is Nothing Then...
Proszę[syntax=vb]Dim komTmp As String Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Not Intersect(Target, Range("A1:B4")) Is Nothing Then Application.EnableEvents = False If komTmp = "" Then komTmp = Target.Address If Range(komTmp) = Empty Then Range(komTmp).Select Else komTmp = Target.Address End If Application.EnableEvents = True...
Jeśli zmiana nieparzystego wiersza ma wywoływać "timestamp" to proponuję raczej :D kod typu: [syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) Set Zak = Intersect(Target, Range("I1:FK100")) If Not Zak Is Nothing Then Application.EnableEvents = False If Target.Row Mod 2 = 1 Then Target.Offset(1, 0) = Date End If End If Target.Columns.EntireColumn.AutoFit...
Cześć. Sprawdź takie makro wykonywane w zdarzeniu "Change" arkusza: [syntax=vbnet]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count <> 1 Then Exit Sub If (Target.Column = 1 And Target.Offset(0, 2).Value = "") Then Target.Offset(0, 2).Value = Date End If End Sub[/syntax]
Private Sub Worksheet_SelectionChange(... - jest reakcję na zmianę położenia kursora w arkuszu. (zdarzenie arkusz_ZmianaZaznaczenia) If Target.Column <> 12 Then Exit Sub- tylko dla kolumny L, w przeciwnym razie przerwać pracę. W Twojim przypadku[syntax=vb]Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Column = 12 Then Range("a7")...
field target target codesys margin target
wtyczki winamp urządzenie klimatyzacji brama hormann sterować
pralka elektrolux blokada drzwiczek silny router
Łożyska w silniku pralki Bosch: typy i specyfikacje Przełączanie między dyskami HDD SATA i IDE: XP, Vista, 10