Re: Worksheet_Selection Change to Activate another sheet in the same workbook
Thank you. This works perfect!
Re: Worksheet_Selection Change to Activate another sheet in the same workbook
Thank you. This works perfect!
Working with data on Sheet1, I want to click on any row in Column A to activate Sheet2 or Sheet3 in the same workbook based on the value of column E. It the Value of Column E is greater than zero I want to activate Sheet2. If the value in column E is zero, then I want to activate Sheet3.
Re: Populate UserForm textbox with contents from inserted Word textbox
Can this be done???
forum.ozgrid.com/index.php?attachment/63780/I am trying to populate UserForm textboxes with data entered in an inserted Textbox and also from an inserted object - Microsoft Word Document textbox. I am having no luck. I have attached a copy of the workbook. Any help would be appreciated.
Re: Be able to select row of data from listbox when more than one (1) result is retur
Thank you pike. You have helped me tremendously!
forum.ozgrid.com/index.php?attachment/63564/forum.ozgrid.com/index.php?attachment/63562/I have attached a sample of a very large workbook I need assistance with. If you search for team T-10 you will have three returns. the program cannot distinguish the three separate rows of data. All of the other "Team" work perfect because they each have only one entry. I need to be able to populate the userform to add comments or edit without creating a duplicate entry. Any suggestions would be appreciated. If the ListBox is Programed properly with the "Edit/Update" button still work?
Private Sub lbxCaseSearch_Click()
'Selection.AutoFilter Field:=1, Criteria1:="<>"
Dim r As Range, rAll As Range, lRow As Long
Dim sTerm As String, ctl As Control
sTerm = lbxCaseSearch.Value
With Sheets("Case Log")
Set rAll = .Range(.Cells(1, 1), .Cells(1, 1).End(xlDown))
For Each r In rAll
If r = sTerm Then
lRow = r.Row
For Each objFrame In Me.Controls
If TypeName(objFrame) = "Frame" Then
For Each ctl In Me(objFrame.Name).Controls
If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then
If ctl.Tag <> "" Then
ctl.ControlSource = ctl.Tag & lRow
End If
End If
Next ctl
End If
Next objFrame
End If
Next
End With
End Sub
Display More
Private Sub btnEdit_Click()
Dim lRow As Long
Dim ctl As Control
lRow = Worksheets("Case Log").Range("A1").CurrentRegion.Rows.Count + 1
For Each ctl In Frame1.Controls
If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then
If ctl.Tag <> "" Then
ctl.ControlSource = ctl.Tag & lRow
End If
End If
Next ctl
Unload Me
End Sub
Display More
Re: Combine frames on UserForm to Update data
Thank you pike! That is exactly what I needed.
I have a UserForm that I update a spread sheet with. The code listed below works perfect. I need help adding two (2) more frames to the existing code. the line that I need help with is: (For Each ctl In Frame1.Controls) How can I add Frame2 and Frame3 to this code?
Private Sub lbxCaseSearch_Click()
Selection.AutoFilter Field:=1, Criteria1:="<>"
Dim r As Range, rAll As Range, lRow As Long
Dim sTerm As String, ctl As Control
sTerm = lbxCaseSearch.Value
With Sheets("Case Log")
Set rAll = .Range(.Cells(1, 1), .Cells(1, 1).End(xlDown))
For Each r In rAll
If r = sTerm Then
lRow = r.Row
For Each ctl In Frame1.Controls
If TypeName(ctl) = "TextBox" Or TypeName(ctl) = "ComboBox" Then
If ctl.Tag <> "" Then
ctl.ControlSource = ctl.Tag & lRow
End If
End If
Next ctl
End If
Next r
End With
End Sub
Display More
Re: Copy selected cells from one workbook and past to another workbook
Thank you for your help. But unfortunately I need to code to be written for one workbook to another.
I have two workbooks. workbook 1 and workbook 2. I want to transfer cells: A1,C4,F7,G8,H2 from Worksheet1 in Workbook1 to Worksheet1 in Workbook2. I would like the copied cell to be pasted directly below the last row on the worksheet in the columns A,B,C,D,E. Any help would be appreciated.
Re: If coulmn "B" has anything entered in it, Leave column "A" blank
Yes. I have a copy & paste function from one sheet to another. I any data is in Col B I dont want the data pasted in Col A.
How can I leave Column "A" blank if any data what so ever is entered in Column "B"?
Re: Transfer Data from one sheet to another sheet without transferring the formulas
Thank you very much.
I have a macro that transfers copies and pastes data from one sheet to another sheet in the same workbook. The second sheet counts time. My problem is that formulas from the first sheet are transferring to the second sheet. How can I prevent formulas from being copied and pasted over to the second sheet? Any help would be appreciated.
Re: Add overtime hours bases on Reason Code and whether cash or time
Thank you for your help etaf.
How can I total overtime based on a "Reason Code" and whether the employee chose "Cash" or "Time" compensation?
Re: Combine three Worksheet Change codes
Thank you StephenR. Your code works great.
Re: Combine three Worksheet Change codes
So should they all be able to work together?
I would appreciate any help in combining three Worksheet selection changes codes for a program I am trying to improve. I have received the codes from this forum and they work excellent. I am just no luck combining them my self.
Code # 1 - used to to transfer hyperlink data to another sheet.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column > 1 Or Target.Value = "" Then Exit Sub
With Sheets("Overtime Report")
.Range("D18") = Target
.Range("D22") = Target.Offset(, 1)
.Range("G22") = Target.Offset(, 2)
.Range("K17") = Target.Offset(, 3)
.Range("M1") = Target.Offset(, 6)
.Range("G18") = Target.Offset(, 9)
With Sheets("Admin")
.Range("M2") = Target.Offset(, 3)
.Range("N2") = Target.Offset(, 4)
End With
End With
End Sub
Display More
Code #2 - used to transfer data from a drop down box to check boxes.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("H5")) Is Nothing Then
ChangeCheckBoxes Worksheets("Overtime Report"), True, Target.Value
End If
End Sub
Sub ChangeCheckBoxes(xlWs As Worksheet, bVal As Boolean, Optional objName As String = vbNullString)
Dim oOle As OLEObject
With xlWs
For Each oOle In .OLEObjects
If InStr(LCase(oOle.progID), "checkbox") > 0 Then
If LCase(Left(oOle.Name, 3)) = "chk" Then
If Mid(oOle.Name, 4) = objName Then
oOle.Object.Value = bVal
Else
oOle.Object.Value = Not bVal
End If
End If
End If
Next oOle
End With
End Sub
Display More
Code #3 - used to type military time without using a colon.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim TimeStr As String
On Error GoTo EndMacro
If Application.Intersect(Target, Range("B5:E370")) Is Nothing Then
Exit Sub
End If
If Target.Cells.Count > 1 Then
Exit Sub
End If
If Target.Value = "" Then
Exit Sub
End If
Application.EnableEvents = False
With Target
If .HasFormula = False Then
Select Case Len(.Value)
Case 1 ' e.g., 1 = 00:01 AM
TimeStr = "00:0" & .Value
Case 2 ' e.g., 12 = 00:12 AM
TimeStr = "00:" & .Value
Case 3 ' e.g., 735 = 7:35 AM
TimeStr = Left(.Value, 1) & ":" & _
Right(.Value, 2)
Case 4 ' e.g., 1234 = 12:34
TimeStr = Left(.Value, 2) & ":" & _
Right(.Value, 2)
Case 5 ' e.g., 12345 = 1:23:45 NOT 12:03:45
TimeStr = Left(.Value, 1) & ":" & _
Mid(.Value, 2, 2) & ":" & Right(.Value, 2)
Case 6 ' e.g., 123456 = 12:34:56
TimeStr = Left(.Value, 2) & ":" & _
Mid(.Value, 3, 2) & ":" & Right(.Value, 2)
Case Else
Err.Raise 0
End Select
.Value = TimeValue(TimeStr)
End If
End With
Application.EnableEvents = True
Exit Sub
EndMacro:
MsgBox "You did not enter a valid time"
Application.EnableEvents = True
End Sub
Display More
Re: Use data on hyperlink to populate form
Thank you StephenR! I just tried your code and it works perfect. Thank you for your time. Chris.