Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 14
Default Simple Copy to and From Cells With IF statement.

Hi all Me again!
im working on a diet form for you GF and i want to make it nice and simple to use basically i have got a macro at the minute that when you click on a button it copys the calories eaten on mon,tue,wed ect.
then goes to a "Weigh in" Sheet and Pastes in a Specific cells.
What i Now need it to do (because the first week is now complete) is to Paste To the next week.

So If N8 = (Value) Then Goto Cell N9 If that cell Has data in it then goto N10 ect.
When it finds a N Cell without Data Paste the Dim Mon(Dim Mon Is set From the origional sheet Befor If Statements).

Then Rince and Repeat for Tue in O8 ect ect.

here is My current Macro
----------------------------------------------------------------------------------
Sub Transfer_Sara()
'
' Transfer_Sara Macro
' Transfers Saras Eaten List to Weigh in sheet
'

'
Dim Mon As Integer
Dim Tue As Integer
Dim Wed As Integer
Dim Thu As Integer
Dim Fri As Integer
Dim Sat As Integer
Dim Sun As Integer

' Makes The New integers the same as on the Meal calc sheet
' Mon = Worksheets("Sheet 1").Range("A65536").End(xlUp).Row
Mon = Worksheets("Meal Planner").Range("C22")
Tue = Worksheets("Meal Planner").Range("C23")
Wed = Worksheets("Meal Planner").Range("C24")
Thu = Worksheets("Meal Planner").Range("C25")
Fri = Worksheets("Meal Planner").Range("C26")
Sat = Worksheets("Meal Planner").Range("C27")
Sun = Worksheets("Meal Planner").Range("C28")

'Transfer data

Sheets("Weigh in").Range("N8") = Mon
Sheets("Weigh in").Range("O8") = Tue
Sheets("Weigh in").Range("P8") = Wed
Sheets("Weigh in").Range("Q8") = Thu
Sheets("Weigh in").Range("R8") = Fri
Sheets("Weigh in").Range("S8") = Sat
Sheets("Weigh in").Range("T8") = Sun

End Sub
------------------------------------------------------------------
How would i go about adding the IF statement to this?

once i Know for one Colum i can figure out the rest :)
Just Learning as i go at the minute!
Thanks for the Help in advance!


Chris
  #2   Report Post  
Senior Member
 
Posts: 663
Default

Quote:
Originally Posted by omen666blue View Post
Hi all Me again!
im working on a diet form for you GF and i want to make it nice and simple to use basically i have got a macro at the minute that when you click on a button it copys the calories eaten on mon,tue,wed ect.
then goes to a "Weigh in" Sheet and Pastes in a Specific cells.
What i Now need it to do (because the first week is now complete) is to Paste To the next week.

So If N8 = (Value) Then Goto Cell N9 If that cell Has data in it then goto N10 ect.
When it finds a N Cell without Data Paste the Dim Mon(Dim Mon Is set From the origional sheet Befor If Statements).

Then Rince and Repeat for Tue in O8 ect ect.

here is My current Macro
----------------------------------------------------------------------------------
Sub Transfer_Sara()
'
' Transfer_Sara Macro
' Transfers Saras Eaten List to Weigh in sheet
'

'
Dim Mon As Integer
Dim Tue As Integer
Dim Wed As Integer
Dim Thu As Integer
Dim Fri As Integer
Dim Sat As Integer
Dim Sun As Integer

' Makes The New integers the same as on the Meal calc sheet
' Mon = Worksheets("Sheet 1").Range("A65536").End(xlUp).Row
Mon = Worksheets("Meal Planner").Range("C22")
Tue = Worksheets("Meal Planner").Range("C23")
Wed = Worksheets("Meal Planner").Range("C24")
Thu = Worksheets("Meal Planner").Range("C25")
Fri = Worksheets("Meal Planner").Range("C26")
Sat = Worksheets("Meal Planner").Range("C27")
Sun = Worksheets("Meal Planner").Range("C28")

'Transfer data

Sheets("Weigh in").Range("N8") = Mon
Sheets("Weigh in").Range("O8") = Tue
Sheets("Weigh in").Range("P8") = Wed
Sheets("Weigh in").Range("Q8") = Thu
Sheets("Weigh in").Range("R8") = Fri
Sheets("Weigh in").Range("S8") = Sat
Sheets("Weigh in").Range("T8") = Sun

End Sub
------------------------------------------------------------------
How would i go about adding the IF statement to this?

once i Know for one Colum i can figure out the rest :)
Just Learning as i go at the minute!
Thanks for the Help in advance!


Chris
Have a look at how to use xlToRight and offset. This will allow you to do what you're trying to do.
  #3   Report Post  
Junior Member
 
Posts: 14
Default

Quote:
Originally Posted by Spencer101 View Post
Have a look at how to use xlToRight and offset. This will allow you to do what you're trying to do.
Thanks Spencer, However

I require it go down then right. What would i need to look up for this?
also a problem i have found when finding blank cells ect. is that alot of the tutorials out there start with A:A were as my Sheet has lots of tables table headers in Cols N-T Rows 6-7 and Blank Cells in N-T Rows 1-5 therefor alot of the tutorials i find dont work Because they are based on an empty sheet of a table Based in Cols A-C (for example).

Any chance of some sample code with explanation? Sorry im just fairly new only been using VBA for like 20 Hours :D

Thanks For taking the time to reply to this and for your patients :)

Chris
  #4   Report Post  
Senior Member
 
Posts: 663
Default

Quote:
Originally Posted by omen666blue View Post
Thanks Spencer, However

I require it go down then right. What would i need to look up for this?
also a problem i have found when finding blank cells ect. is that alot of the tutorials out there start with A:A were as my Sheet has lots of tables table headers in Cols N-T Rows 6-7 and Blank Cells in N-T Rows 1-5 therefor alot of the tutorials i find dont work Because they are based on an empty sheet of a table Based in Cols A-C (for example).

Any chance of some sample code with explanation? Sorry im just fairly new only been using VBA for like 20 Hours :D

Thanks For taking the time to reply to this and for your patients :)

Chris
Hi Chris,

I've been using VBA a little longer than that, but not by much! ;)

Any chance of a sample workbook?

If you don't want to post it here, feel free to email it to me on pubnut @ gmail . com (without the spaces obviously).

S.
  #5   Report Post  
Junior Member
 
Posts: 14
Default

Quote:
Originally Posted by Spencer101 View Post
Hi Chris,

I've been using VBA a little longer than that, but not by much! ;)

Any chance of a sample workbook?

If you don't want to post it here, feel free to email it to me on pubnut @ gmail . com (without the spaces obviously).

S.
Added Below

So I need the Buttons to Paste in Weigh in sheet from Meal Calculator :) free to use it as well if ya go on a diet :)

Have a looksy any Questions dont hessitate to ask :)


cheers for looking
chris
Attached Files
File Type: zip Sara's Special Sheet.zip (34.3 KB, 34 views)
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
does any one know to copy cells within an IF statement in Excel DonE Excel Worksheet Functions 10 June 2nd 09 12:42 AM
copy cells from multiple pages to one sheet w/ if statement GHall Excel Worksheet Functions 8 January 15th 09 08:24 PM
Simple If Statement KWhamill Excel Programming 1 July 16th 08 10:06 PM
If statement...copy values of cells on another worksheet. heater Excel Discussion (Misc queries) 2 August 31st 05 11:05 PM
Simple If Statement DM Excel Programming 2 July 27th 04 08:26 PM


All times are GMT +1. The time now is 05:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"