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]
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=vb]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 3 And Target.Value = 3 Then Target.Offset(0, -1) = Date - 1 End Sub [/syntax] lub [syntax=vb]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 3 Then If Target.Value = 3 Then Target.Offset(0, -1) = Date - 1 Else Target.Offset(0, -1) = Date End If End...
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]
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...
[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 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]
[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]
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]
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")...
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...
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]
[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]
Private Sub Worksheet_Change(ByVal Target As Range) Dim Komorka As Range If Not Application.Intersect(Rows(5), Range(Target.Address)) Is Nothing Then For Each Komorka In Target.Cells Select Case Komorka.Value Case "TAK": . . . End Select Next End If End Sub
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...
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)...
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]
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.
Jedynie jak zaznaczę niechcący więcej jak jedną komórkę i wprowadzę jakiekolwiek dane to po potwierdzeniu wyskakuje błąd: Podmień [syntax=vbscript]Dim s As Variant Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("A1:A10")) Is Nothing Then If Target = "" Then Exit Sub Application.EnableEvents = False If Left(Target,...
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]
[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]
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]
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]
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.
Że tak się wtrącę ... Nie uczysz się :) Spróbuj załapać o co chodzi w kodzie (przeczytać go) a sam zaczniesz pisać kody uzależnione od zmian w arkuszu. (if) jeżeli (Target.Column = 6) zmiana dotyczy kolumny nr 6 czyli F (AND) oraz (UCase(Target.Value) = "K") zmieniana wartość zmieniona na duże litery równa jest K (Then) wtedy (Target.Value = "Komunalne")...
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...
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]
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 <=...
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,...
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)...
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...
Teraz wszystko jasne. [syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 2 Then Application.ScreenUpdating = False Plik = "C:\PlikiSpraw\" & Range("A" & Target.Row) & ".xlsx" If Dir(Plik) <> "" Then Rows(Target.Row).Copy Set s = Workbooks.Open(Plik) nw = s.Sheets(1).Cells(Rows.Count, "A").End(xlUp).Row...
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]
:arrow: bobo InStr Trzeba podstawić[syntax=vb]Private Sub Worksheet_Change(ByVal Target As Range) Dim test As Integer If Target.Count > 1 Then Exit Sub If Not Intersect(Target, Range("Q58:V119")) Is Nothing Then test = InStr(1, Target.Value, "+") If test = 0 Then Exit Sub Application.EnableEvents = False On Error Resume Next Target.Value = "=" & Target.Value...
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]
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...
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...
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(),...
Np taką procedurą zdarzeniową (wklej w kod arkusza)[syntax=vb]Private Sub Worksheet_Change(ByVal Target As Range) Dim wrs As Integer If Not Intersect(Target, Range("B9:B20")) Is Nothing Then If Target = "wybierz z listy" Then wrs = Target.Row + 23 'czyścimy Target.Offset(0, 1) = 0 Cells(wrs, 6) = 0 Cells(wrs, 7) = 0 End If End If End Sub[/syntax]Rozumiem,...
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]
Testuj kolumnę, przypisuj na offsetach. Np[syntax=vb]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 Then If Target.Value = "x" Then 'Range("C1") = Range("B1") Target.Offset(0, 2) = Target.Offset(0, 1) Else 'Range("C1") = "" Target.Offset(0, 2) = "" End If End If End Sub[/syntax]
Moja propozycja - kod do umieszczenia w module arkusza: [syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column > 2 Or Target.Value = "" Then Exit Sub Select Case Target.Column Case 1 Call UtworzFolder(Target.Value) Case 2 If Target.Offset(0, -1).Value <> "" Then Call PrzeniesFolder(Target.Offset(0, -1).Value)...
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]
[syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$10" Then Application.EnableEvents = False Range("A11:A" & 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,...
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...
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...
Skoro Kolega chce VBA, to proszę. Kod dla modułu 'Arkusz3': [syntax=vb]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Row = 2 And Target.Column = 2 Then If Target.Cells = "XYZ" Then Call Kopiuj End If End Sub[/syntax] Kod modułu skoroszytu: [syntax=vb]Sub Kopiuj() s = Sheets("Arkusz3").Range("B2") Sheets("Arkusz1").Select ow = Cells(Rows.Count,...
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]
ad 1. Można wykorzystać następujący kod dla zdarzenia Worksheet_Change arkusza: [syntax=vbscript]Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 12 And (Cells(Target.Row, Target.Column).Offset(, -1).Value + Cells(Target.Row, Target.Column).Offset(, -2).Value = 0) Then Target.Value = 0 End If End Sub[/syntax] ad 2. Wystarczy poprawność...
target margin target systemu field target
panewka wymiana autocom jedno kanaly satelity hotbird
lampa sygnalizacyjna interfejs delphi
Vestel 17MB211S F&U TV Firmware for VES480UNDS-2D-N12 Panel Trevi 1072 – włączanie wieży: pilot czy przycisk STANDBY/POWER?