I am trying do something in Excel that I do in Access and because of some people not having MS Office Professional and hence no Access.
Let's say we have 100 rows and each row has a person's name etc and one of the cells has the name of a Word.doc file that has a date/time stamp such as "2008-12-03_14-48-24 Wilson Letter 1". Is possible to place and OnClick event that will apply to all rows and use the data in the cell for reference as opposed to the full cell name.
At the moment I know how to make the event run if a cell is clicked on but I can only do it for an invidual cell and the way I am doing it would be extremely clumsy if there were 100s of rows. I use the code below. Apart from the clumsy nature of the code what would happen if the rows were sorted differently. Hence, is there a way to reference only the column and the row is reference by the data on the row.
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
With Target
If .Count > 1 Then Exit Sub
If .Address(False, False) = "A1" Then
Call Macro4
End If
If .Address(False, False) = "A2" Then
Call Macro4
End If
If .Address(False, False) = "A3" Then
Call Macro4
End If
End With
End Sub
The above has obvious problems if 100s of rows are involved.
I also have a similar problem with the code that saves the file name in that I have to reference the full cell number as in
Range("G33") = ("Viper " + Format(Now, "YYYY-MM-DD") + " " & Format(Now, "hh-mm-ss")) which puts
Viper 2008-12-07 00-28-43 in G33. Doing this in Access would only involve the field (column)as the reference as the row would be automatically determine because I would be clicking on a textbox or buttom that was part of each row. I am trying to dupicate this Excel.
Let's say we have 100 rows and each row has a person's name etc and one of the cells has the name of a Word.doc file that has a date/time stamp such as "2008-12-03_14-48-24 Wilson Letter 1". Is possible to place and OnClick event that will apply to all rows and use the data in the cell for reference as opposed to the full cell name.
At the moment I know how to make the event run if a cell is clicked on but I can only do it for an invidual cell and the way I am doing it would be extremely clumsy if there were 100s of rows. I use the code below. Apart from the clumsy nature of the code what would happen if the rows were sorted differently. Hence, is there a way to reference only the column and the row is reference by the data on the row.
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
With Target
If .Count > 1 Then Exit Sub
If .Address(False, False) = "A1" Then
Call Macro4
End If
If .Address(False, False) = "A2" Then
Call Macro4
End If
If .Address(False, False) = "A3" Then
Call Macro4
End If
End With
End Sub
The above has obvious problems if 100s of rows are involved.
I also have a similar problem with the code that saves the file name in that I have to reference the full cell number as in
Range("G33") = ("Viper " + Format(Now, "YYYY-MM-DD") + " " & Format(Now, "hh-mm-ss")) which puts
Viper 2008-12-07 00-28-43 in G33. Doing this in Access would only involve the field (column)as the reference as the row would be automatically determine because I would be clicking on a textbox or buttom that was part of each row. I am trying to dupicate this Excel.