Hi there,
I found somebody online writing the following code, but it doesn't work with me , could you help please:
.Range(4&":"&89).EntireRow.Hidden = True
Thanks
Hi,
The syntax is not valid. What are you trying to do with that code?
As an example, this line will hide Row 1
Range("A1").EntireRow.Hidden = False
regards
Phil
Hi Philip
First Off All, thank you for your reply because I'm really surprised,
I wanted to hide the rows mentioned into the code.
I'm following Randy to make an App , he wrote this code, please check the link below " current time on youtube where he just wrote the code without any problem"
This one : .Range(4&":"&89).EntireRow.Hidden = True
And sure it doesn't work,
As for me ChatGPT gave me this one:
.Range("4:" & "89").EntireRow.Hidden = True
Is ChatGPT replace exactly Randy's code ?
And why Randy's code works with him and not with me ?
Thank you Philp
Hi,
He may have written the code in the editor but I didn't see him run it. If he ran it, it would generate an error because it is incorrect. I also noticed other lines with the same mistake.
The correct code is
.Range("4:" & "89").EntireRow.Hidden = True
regards
Phil
This is a typical case of users seeing code they found and using it without understanding what they're doing.
The most important thing I always tell the persons using my code is that you also need to read it as you would a book, code is processed line by line like when reading a book.
If the syntax is respected then you might understand what it is doing and will pave the way for VBA coding.
The answer ginven by the OP proves again the danger lying in blindly trusting GPT
Hi there,
Sure I try my best not only to copy codes but to understand,
I have the same problem with the following codes ?
.Filters.Add "All Picture Files", "*.jpg,*.Png,*.Gif", 1
If .Show <> -1 Then GoTo NoSelection
Best regards,
Samir.
Hi Samir,
Hard to help with that since it's out of context. Need all the other code around it to see why it isn't working.
Phil
Hello Philip,
The whole code is:
Sub Vehicle_Addpic()
Dim Getfile As FileDialog
SetGetfile = Application.FileDialog(msoFileDialogFilePicker)
With Getfile
Title = "Add Vehicle Picture"
.Filters.Add "All Picture Files", "*.jpg,*.Png,*.Gif", 1
If .Show <> -1 Then GoTo NoSelection
Sheet1.Range("J13").Value = .SelectedItems(1)
Vehicle_ShowPic
NoSelection:
End With
End Sub
Regards
Samir.
FYI, the only thing wrong with your initial code (assuming it's inside a With block) was that you were missing some spaces:
.Range(4 & ":" & 89).EntireRow.Hidden = True
Your last code is also missing a space in this line:
SetGetfile = Application.FileDialog(msoFileDialogFilePicker)
which should read:
Set Getfile = Application.FileDialog(msoFileDialogFilePicker)