Macro add Hyperlink formula

Z

zak

Hi Dave

No - the "Appointments" sheet is not relating to me query, I'm still talking
about the Toshiba and dell sheets. I'll give the code a try now. Thanks
again.
 
Z

zak

Hi Dave

The code you have given me below works a treat, as I wanted. So, THANK YOU
VERY MUCH! I adapted your code to help me in other areas of my spreadsheet
system which I had similar issues that new rows were not being added, so
thanks again for all your help.

There was something else, I had posted another issue on here, which i did
get a response for, but I had to e-mail the person again and have had no
reply in a few days because I needed further help. So, if you can help me
with this too, it will be greatly appreciated, hopefully I can meet my
deadline too:

When the Toshiba (00226) sheet gets populated from info entered into the
form, I've added a new column,K, which the heading is "Complete?". Then in
column K i have created a list drop down (via Data - Validation - Allow:List
etc) with two options (1. Complete or 2. Pending). My intention is that when
Complete is selected from the drop down for a particular row, I'd like the
row from A:K to be cut and pasted into the Toshiba_History sheet from row 2
onwards, as row 1 contains headings). Then once pasted, that row in Toshiba
(00226) should get deleted.

After this, any new rows in Toshiba (00226) that have complete in row K
should get pasted in a new row in Toshiba_History (so it's the adding the
info to a new row again).

Please let me know if you can help. The person helping me before has not
responded and my deadline has been set by my manager for this Friday.

Here is my code that I have, but it doesn't work as I wanted i.e. it copies
the whole row when I just want it to cut the row from column A to K, and once
copied, the info on Toshiba (00226) does not get deleted.

Sub PasteTosh()
'Sheet3 .....all data..(Toshiba (00226))
'Sheet6......contains filtered data_(Toshiba_History)
Dim i, j, n As Integer
j = 1
Sheet3.Activate
For i = 1 To Sheet3.UsedRange.Rows.Count
If (Cells(i, 11) = "Complete") Then
For n = 1 To Sheet3.UsedRange.Columns.Count
Sheet6.Cells(j, n) = Sheet3.Cells(i, n)
Next n
j = j + 1
End If
Next i
End Sub
 
D

Dave Peterson

Maybe...


Option Explicit
Sub PasteTosh2()

Dim FromWks As Worksheet
Dim FirstRow As Long
Dim ToWks As Worksheet
Dim FromRow As Long
Dim DestCell As Range

Set FromWks = Worksheets("Toshiba (00226)")
Set ToWks = Worksheets("toshiba_history")

With ToWks
'assumes that column A is always used!
Set DestCell = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0)
End With

With FromWks
FirstRow = 2 'headers in row 1???
For FromRow = .Cells(.Rows.Count, "K").Row To FirstRow Step -1
If LCase(.Cells(FromRow, "K").Value) = LCase("Complete") Then
'copy 11 columns to the destination cell
.Cells(FromRow, "A").Resize(1, 11).Copy _
Destination:=DestCell
'delete that entire row
.Rows(FromRow).Delete
'get ready for the next one (move down a row)
Set DestCell = DestCell.Offset(1, 0)
End If
Next FromRow
End With
End Sub

(Untested, but it did compile.)

You may want to look at Ron de Bruin's EasyFilter addin:
http://www.rondebruin.nl/easyfilter.htm

If you ever have more options and each option gets its own worksheet
 
Z

zak

Thanks Dave

Your code works perfectly. Thank you for all your help.

Now - This is my last question for now, i promise, do you know anything
about sendin automatic e-mail where I won't have to even create a button to
send the e-mail, nor open the workbook up - i want it to be totally auto
generated. I have code that works fine, but i have to press a button in
order for it to work. But I want something, where its completely auto
generated.

It's OK if you can't help, Im grateful for all your help thus far. But if
you think you can help, then please see my code below, which runs from
pressing a button:

Thanks in advance:

Sub TestFile_2()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range

Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon

On Error GoTo cleanup
For Each cell In
Sheets("RSReleaseDates").Columns("B").Cells.SpecialCells(xlCellTypeConstants)
If cell.Value Like "?*@?*.?*" And LCase(cell.Offset(0, 1).Value) =
"yes" _
And LCase(cell.Offset(0, 2).Value) <> "Sent" Then
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = cell.Value
.Subject = "Reminder - New RhymeSIGHT Release Coming Soon"
.Body = "Dear " & cell.Offset(0, -1).Value & vbNewLine &
vbNewLine & _
"A new version of RhymeSIGHT is due to be released 7
days from receipt of this e-mail." & vbNewLine & vbNewLine & _
"Please e-mail me to arrange a date to upgrade your
laptop." & vbNewLine & vbNewLine & _
"Thank You." & vbNewLine & vbNewLine & _
"(YOUR NAME)" & vbNewLine & vbNewLine & _
"On Behalf of Support Services"
.Display 'or use Send
End With
On Error GoTo 0

cell.Offset(0, 2).Value = "Sent"
Set OutMail = Nothing
End If
Next cell

cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
 
D

Dave Peterson

If you're going to stay in excel, you'll have to open excel and the workbook.
If you don't want to click the button, you could use the Auto_Open or
workbook_open procedures that run when the workbook is opened.

And if you don't want to even open excel and the workbook, maybe you could use a
scheduling program (some versions of windows have their own, but you can find
others on google).

And if you haven't looked at Ron de Bruin's site, it may come in handy someday):
http://www.rondebruin.nl/tips.htm

Good luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top