ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro Modification (https://www.excelbanter.com/excel-programming/426401-macro-modification.html)

akemeny

Macro Modification
 
How can I modify the macro below so that it will look at the values of the
cell rather than the link in the cell. The situation is that I have a master
spreadsheet that contains links to all of the individual spreadsheets, but I
need this code to look at the value of each cell rather than looking at the
link. Any help would be greatly appreciated.

Sub getvalues()
lr = Application.Max(2, Cells(Rows.Count, 1).End(xlUp).Row)
'MsgBox lr
Rows("2:" & lr).ClearContents
With Worksheets("Master")
slr = .Cells(Rows.Count, "c").End(xlUp).Row
'MsgBox slr
For i = 6 To slr
dlr = Cells(Rows.Count, "a").End(xlUp).Row + 1
' If .Cells(i, "ba") 1 Then .Rows(i).Copy Rows(dlr)
If .Cells(i, "ba") 1 And Not IsDate(.Cells(i, "bb")) Then
..Rows(i).Copy Rows(dlr)
Next i
End With
End Sub

JLGWhiz[_2_]

Macro Modification
 
You already had the answer. Use the Value property to return the value.

Sub getvalues()
lr = Application.Max(2, Cells(Rows.Count, 1).End(xlUp).Row)
'MsgBox lr
Rows("2:" & lr).ClearContents
With Worksheets("Master")
slr = .Cells(Rows.Count, "c").End(xlUp).Row
'MsgBox slr
For i = 6 To slr
dlr = Cells(Rows.Count, "a").End(xlUp).Row + 1
' If .Cells(i, "ba").Value 1 Then .Rows(i).Copy Rows(dlr)
If .Cells(i, "ba").Value 1 And Not IsDate(.Cells(i, "bb")) Then
..Rows(i).Copy Rows(dlr)
Next i
End With
End Sub



"akemeny" wrote in message
...
How can I modify the macro below so that it will look at the values of the
cell rather than the link in the cell. The situation is that I have a
master
spreadsheet that contains links to all of the individual spreadsheets, but
I
need this code to look at the value of each cell rather than looking at
the
link. Any help would be greatly appreciated.

Sub getvalues()
lr = Application.Max(2, Cells(Rows.Count, 1).End(xlUp).Row)
'MsgBox lr
Rows("2:" & lr).ClearContents
With Worksheets("Master")
slr = .Cells(Rows.Count, "c").End(xlUp).Row
'MsgBox slr
For i = 6 To slr
dlr = Cells(Rows.Count, "a").End(xlUp).Row + 1
' If .Cells(i, "ba") 1 Then .Rows(i).Copy Rows(dlr)
If .Cells(i, "ba") 1 And Not IsDate(.Cells(i, "bb")) Then
.Rows(i).Copy Rows(dlr)
Next i
End With
End Sub





All times are GMT +1. The time now is 06:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com